WordPress for Raspberry Pi using Nginx and MySQL

I’ve been wondering how the Raspberry Pi would handle WordPress. I’ve found some instructions using Apache 2, but this may not be the best server to use for this type of low-end hardware. nginx server requires less resources, and as it is what I already setup for this blog, I decided to give it a try on the Pi.

I’ll provide all the detailed steps I followed below, but you can also download the compressed SD card image (113 MB), uncompress it and copy it to an SD card the usual way. After the system boots, find your Raspberry Pi’s IP address, type it in your PC’s browser, and you should see the page pictured below. If you want to login to the dashboard, the username is “admin” and the password “raspberry”.

Instructions to Install WordPress on Raspberry Pi

You can use your default Debian Linux distribution (e.g. Raspbian) if space if not an issue, but all what I did below is based on Raspbian minimal image.

Install ngnix, php and mysql in the server:


You’ll be asked for mysql root password. I used “raspberry” of course!

Create a nginx configuration file for your WordPress blog in /etc/nginx/sites-available/wordpress:


Enable your wordpress blog:


As mentioned in the note in the config file above, edit /etc/php5/fpm/php.ini to enable the line:


You can try if nginx is running properly at this point, first start it:


and try to access it from your PC’s browser using Raspberry Pi IP address (e.g. 192.168.0.106), you should see:

Welcome to nginx!

Now let’s download and extract WordPress into the RPi:


Now let’s follow WordPress installation instructions:


In /srv/www/wordpress/public_html directory edit WordPress configuration:


and update the database details as follows:


Finally change the directory permissions and start(or restart) nginx and php5-fpm.


Now access the following IP address in your PC’s web browser

http://192.168.0.106/wp-admin/install.php

Where you need to replace 192.168.0.106 with your Raspberry Pi IP address.

WordPress Installation Page Rendered on the Raspberry Pi

Fill the details (I used “raspberry” password), click on Install WordPress, and follow the  installation instructions in your browser. You should now be able to login to the Dashboard and create a post. For better performance, I’ve installed W3 Total Cache plugin, and enabled Page, Browser and Object caching. Once caching is enabled, the pages should load immediately (less than a second) for non-logged in users. I did experience one issue with caching enabled but not working. This was solved by clearing my browser cookies. Go figure. Since the dashboard is not cached, editing posts and adding pictures is somewhat slow but still usable.

WordPress Benchmarks on Raspberry Pi

Finally, I’ve done some benchmarks on the main page using ApacheBench from another Linux machine on the LAN with 10 concurrent users making 100 requests:


With this simple WordPress page, the Raspberry Pi can handle 3.44 Requests per second, which is equivalent to around 12,400 requests per hour or nearly 300,000 requests per day.

You might want to try to further improve performance by using PHP APC and Varnish, or replacing MySQL with SQLite3.

Support CNX Software - Donate via PayPal or cryptocurrencies, become a Patron on Patreon, or buy review samples
Advertisements
Subscribe
Notify of
guest
38 Comments
oldest
newest most voted
Advertisements