nginx, wordpress & arm server Part 1

Posted: June 26, 2012 in linaro, server

Updated : links to the new home for the linaro based server image and nginx armhf debs.

In science being able to reproduce results outside of the lab is essential. I thought I would try and reproduce the performance results of this blog post about a high performance word press server using an ARM device. I’ve made updates based on Linaro images, and have prebuilt armhf debs for nginx besides a few setup things.

In my case I’m using a Panda ES which is of course a dual core cortex A-9 omap4 4460 with 1 Gig of RAM.

Let’s get started.

  1. Download the lnmp-server image from here.
  2. Boot the image
  3. apt-get update
  4. apt-get install mysql-server (but sure to set the server password and remember it!)
  5. Download nginx-common_1.2.1-0ubuntu0ppa1~precise_all.deb and nginx-full_1.2.1-0ubuntu0ppa1~precise_armhf.deb from here.
  6. dpkg -i nginx-common_1.2.1-0ubuntu0ppa1~precise_all.deb nginx-full_1.2.1-0ubuntu0ppa1~precise_armhf.deb
  7. apt-get install -f  (this will pull in various deps that nginx needs)
  8. mysql -u root -p
  9. Enter CREATE DATABASE wordpress;
    GRANT ALL PRIVILEGES ON wordpress.* TO “wp_user”@”localhost” IDENTIFIED BY “ENTER_A_PASSWORD”;
    FLUSH PRIVILEGES;
    EXIT
  10. apt-get install php5-fpm php-pear php5-common php5-mysql php-apc
  11. edit /etc/php5/fpm/php.ini
  12. add to the bottom
    [apc]
    apc.write_lock = 1
    apc.slam_defense = 0
  13. edit /etc/php5/fpm/pool.d/www.conf
  14. replace
    listen = 127.0.0.1:9000

    with

    listen = /dev/shm/php-fpm-www.sock
  15. and then add
    listen.owner = www-data
    listen.group = www-data
    listen.mode = 0660
  16. edit /etc/nginx/nginx.conf
  17. In the http section add
    port_in_redirect off;
  18. find
    # server_names_hash_bucket_size 64;

    change to

    server_names_hash_bucket_size 64;
  19. edit /etc/nginx/conf.d/drop and place the contents of this link into the file
  20. edit /etc/nginx/conf.d/default.conf and place the contents of this link into the file
  21. Within the same file, change all instances of domainname.com to your appropriate domain.
  22. mkdir -p /var/www/
    chmod 775 /var/www
  23. service nginx start
  24. service php5-fpm restart
  25. cd /tmp
    wget http://wordpress.org/latest.tar.gz
    tar xfz latest.tar.gz
    mv wordpress/* /var/www/
  26. cp /var/www/wp-config-sample.php /var/www/wp-config.php
  27. edit /var/www/wp-config.php
  28. Visit this link and replace the fields in file with the values produced by the web page
  29. In the same file replace the following
    define('DB_NAME', 'wordpress');
    
    define('DB_USER', 'wp_user');
    
    define('DB_PASSWORD', 'whatever you entered for a password');
  30. Visit http://www.yourdomainname.com/wp-admin/install.php
  31. Fill in the fields appropriately
  32. Afterwords, log in
  33. Go to settings -> permalinks, select custom structure and enter
    /%post_id%/%postname%

    Then hit “Save Changes”

Now we are to a point where you can run your system by creating a first post and doing some testing with ab. I did so and at this point found the numbers weren’t that great.

Time to start to enable caches. Goto the admin page, select plugins, and then install new plugin. Search for the “W3 Total Cache” plugin and install it. After this is complete click on active plugin.

Now select the performance menu on the left on side. For all the entries, if you have an option to choose “PHP APC” do so. You’ll also need to specifically enable:

Database Cache
Object Cache

Save all settions, and the select deploy.

Again at this point you can run ab and collect performance data. I can see from my data that things are much improved and replicating nicely. Data and pretty graphs tomorrow. But I’m far from being done yet. Stay tuned!

About these ads
Comments
  1. cnxsoft says:

    I’ve upgraded my x86 Ubuntu server to use nginx instead of apache over the week-end and followed similar steps, except the following:

    [apc]
    apc.write_lock = 1
    apc.slam_defense = 0

    port_in_redirect off;

    server_names_hash_bucket_size 64;

    Are those used to improve performance ?

    I’ve also got to try that on my Mele A1000 (Cortex A8) as well.

    • tgallfoo says:

      I’d have to read the docs to see what all those do. server_names_hash_bucket_size 64; I needed as with the default setting of server_names_hash_bucket_size 32; nginx failed to start.

      After I have this fully reproduced, I want to profile the solution and see if there might be some potential optimizations yet.

  2. r says:

    man, thank you. i was searching for some hours why apc caused segementation faults on my Zyxel NAS (NSA310), this seemed to have solved it until now. How did you find out about these options?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s