Hosting WordPress on Raspberry Pi – A complete approach

Raspberry Pi 3

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.

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.

GTMetrix test result
GTMetrix test scores of WordPress on Raspberry Pi
PageSpeed Desktop test result
Google PageSpeed Desktop test shows 95/100 score
PageSpeed Mobile test result
Google PageSpeed Insights mobile test shows 84/100 score

6 comments by readers

  1. Hey,

    your server shows this today:

    < verwendet ein ungültiges Sicherheitszertifikat. Das Zertifikat ist am 24. Dezember 2017, 00:59 abgelaufen. Die aktuelle Zeit ist 24. Dezember 2017, 11:36. Fehlercode: SEC_ERROR_EXPIRED_CERTIFICATE"

    it mean that your certificate ist expiered on "24. Dezember 2017, 00:59"

    You have to renew



  2. Will this work on a Raspberry Pi 2? I will upgrade to the Pi 3 if I start pulling any appreciable traffic. I already have a domain name but would like to host my own site for now.

    1. I never had a RPi 2, but I have done the same configuration on older Raspberry Pi so I can’t think of any reason that it won’t work for RPi 2.

  3. I have installed following You instructions and it works very well but it would be nice if You could give instructions how to update PHP to latest version.


  4. What about the mails? Can you put an article in setting up a mail server.
    Right now I have multiple domains hosted in my raspberry pi but none of the domains are sending email in wordpress.
    Thanks in advance

Comments are closed.