What you see is a WordPress web server running on a Raspberry Pi 3, and this is a series of articles on how I host WordPress on Raspberry Pi 3 and optimise it to achieve impressive performance and a capable WordPress web server.
- Part 1 – Tighten Raspberry Pi security
- Part 2 – Installing Nginx, PHP and MariaDB
- Part 3 – Setting up WordPress
- Part 4 – Optimise WordPress through cache
- Part 5 – Dedicated IP, Domain name and DNS
- Part 6 – Implement SSL
- Other – Mount a hard disk to Raspberry Pi as root file system
To host a WordPress on Raspberry Pi is more than just a few “apt-get install” commands, there are a lot considerations such as security, response speed, etc., giving that Raspberry Pi is not as powerful as a commercial server. But if you do it correctly, it can be a capable WordPress server with quite impressive results.
There are plenty of such articles already available on the Internet, so you might be wonder why another article about hosting WordPress on Raspberry Pi. Well, Most of those so-called tutorials or articles over-simplified the processes by only focus on the installation of Apache, PHP, MySQL, and WordPress. The “how to install” instructions in fact are the easy part of creating a WordPress site, and it may looks fine if you are just trying it out on Raspberry Pi or use it in a local environment, but there are much more to consider when you want to host the WordPress on a Raspberry Pi in the real online environment. You would need to consider site security, performance optimisation, etc.. I want to take a complete approach by assuming that I’d want to put a Raspberry Pi online as a WordPress web server, optimises it and see how far it can go to handle the real world traffic, along the way, I hope that I learn something new through tinkering.
Although Raspberry Pi 3 as a small $35 credit-card size computer, but it is relatively powerful with 1.2 GHz 64/32-bit quad-core ARM Cortex-A53 microprocessor, and 1 GB RAM at 900 MHz. This is often better than the low price Virtual Private Server (VPS) that you can rent from some data center (you could get a single core, 512MB RAM VPS around $10/month), so if you just started or considering to build a web site, why not give it a try to start on Raspberry Pi first and see how far it can go. Although this article is based on Raspberry Pi, but the processes of setting it up could apply to any Linux server environment when you eventually want to hosting your WordPress on a commercial web hosting service.
For this project, I’m going to use a Raspberry Pi 3, with a fresh created SD card containing Raspbian Jessie Lite*(This article has since updated based on latest Raspbian Stretch) operating system. For best performance, I chose Nginx instead of Apache. I’m using a MacBook Pro as my terminal and access the Raspberry Pi via SSH connection (which is likely the way when you accessing a hosted service). Since I don’t have any Window-based PC, the steps detailed in this series are written based on my Mac environment, so when I say copy to the click board, I assumed that you know that means press Command-C on the Mac. I’m also assuming all readers of this article are comfortable using the command line.
So let’s begin building our new server.
Update 14 Dec, 2016 – With the server optimisation and various caches implementation described in this series, plus some WordPress optimisation tinkering, the Raspberry Pi 3 WordPress server achieved amazing scores on both GTMetric test scores, and Google PageSpeed Insights! I’m impressed on both Nginx and Raspberry Pi 3 performances.