| More

It is meant to function as a staging or testing server where you can  do compatibility test  latest wordpress version on your existing sites, or try themes, plugins,widgets or practice your coding skills in css & php before deploying into your production, then using rpi is a good option.

Components used and tested working:

Raspberry Pi Model B , installed with Raspbian GNU/Linux 8 Jessie (Kernel armv6l Linux 4.9.35+)
nginx(1.6.2-5+deb8u5) (Web Server)
php5 (php5 5.6.33)
mysql 5.5 (ver.5.5.59-0+deb8u1) (Database Server)

Before start the actual installation, update rpi packages

pi@raspberrypi:~ $ sudo apt-get update; sudo apt-get upgrade

Sample output:
pi@raspberrypi:~ $ sudo apt-get update; sudo apt-get upgrade
Get:1 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:2 http://mirrordirector.raspbian.org jessie/main armhf Packages [9,536 kB]
Get:3 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Fetched 9,874 kB in 46s (210 kB/s)
Reading package lists… Done
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
176 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Need to get 94.4 MB/97.3 MB of archives.
After this operation, 3,064 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Fetched 94.4 MB in 2min 47s (564 kB/s)
Reading changelogs… Done
Running hooks in /etc/ca-certificates/update.d….done.

1. Install Nginx 

pi@raspberrypi:~ $ sudo apt-get install nginx

Test if everything ok by running:

pi@raspberrypi:~ $ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Start nginx and check status if running:
pi@raspberrypi:~ $ sudo service nginx start
pi@raspberrypi:~ $ sudo service nginx status

Open your favorite web browser and test it by going to Pi’s localhost or actual IP, e.g. http://localhost , . If working, you will be able to see the default page which is the index.html under /var/www/html , and see message something like:


If any changes done, reload the config
pi@raspberrypi:~ $ sudo systemctl reload nginx

2. Install PHP

As WordPress is written in PHP, we need to install PHP as the scripting language . PHP is a server-side programming language that can serve dynamic pages and it is processed via its php module
a. Install using the following command:
pi@raspberrypi:~ $ sudo apt-get install php5 php-fpm php5-mysql

b. Configure the nginx configuration file for php module to work. Modify the default file under /etc/nginx/sites-available directory, make sure to uncomment or add the following lines:
pi@raspberrypi:~ $ sudo vi /etc/nginx/sites-available/default

index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
include fastcgi.conf;
location ~ /\.ht {
deny all;

Test by doing the following steps:

a.  Create index.php under the default root directory (/var/www/html) with the contents below:
pi@raspberrypi:~ $ sudo vi /var/www/html/index.php


b. Access http://localhost or, if you see something like this as per below image, then php was sucessfully installed.

3. Install MySQL server

pi@raspberrypi:~ $ sudo apt-get install mysql-server

root password will be asked during installation , this will use to access the MySQL engine.

Login to mysql as root with the password provided during installation. Create a database name “wordpress” and wordpress user and grant all privileges for that database  e.g. (db name: wordpress username: wpadmin pass: freelinux)


mysql> CREATE USER wpadmin@localhost IDENTIFIED BY ‘freelinux’;
mysql> CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wpadmin@localhost IDENTIFIED BY ‘freelinux’;
mysql> quit;
Query OK, 1 row affected (0.00 sec)

4. Install WordPress

Download, install, extract and change file ownership
pi@raspberrypi:~ $ cd /var/www/html
pi@raspberrypi:~ $ sudo wget http://wordpress.org/latest.tar.gz
pi@raspberrypi:~ $ sudo tar zxvf latest.tar.gz
pi@raspberrypi:~ $ sudo rm latest.tar.gz
pi@raspberrypi:~ $ sudo chown -R www-data /var/www/html/wordpress

Navigate using your browser and will be presented with WordPress welcome page
-Click “Let’s go” to proceed the setup
-Will be presented by the following, fill out accordingly (in case need to change, can modify the wp-config.php later on):
Database Name: wordpress
User Name: wpadmin
Password: freelinux
Database Host: localhost
Table Prefix: wp_

-Click Submit
-Click “Run the install”
-Next fill out necessary information such as Site Title, username, password and email address. Then click the “Install WordPress” button

Once done, login using the username and password provided earlier, URL is

Enjoy customizing your wordpress by changing themes, installing plugins and widgets , or can edit the stylesheet css if necessary.
Now you’re ready to start adding your first ever post. Happy blogging!

Sample screencap:


Additional Tips or optional tasks:

1. If you have existing database and want to restore from backup database, here’s the command to restore

pi@raspberrypi:~ $ mysql -u wpadmin -p wordpress < freelinux-backup.sql

2. If migrating WordPress from Apache to Nginx, permalinks may not work even after re-saving changes (Settings > Permalinks > Save Changes). Try to change the “try_files from $uri $uri/ =404 to $uri $uri/ /index.php?$args

before:  try_files $uri $uri/ =404;
after:     try_files $uri $uri/ /index.php?$args;

3. Can create virtualhost if have multiple instances of wordpress

13 Responses to “Installing WordPress in Raspberry Pi with Nginx, MySQL and PHP”

  1. abbakfonia

    on July 5 2019


  2. empflix

    on December 13 2019

    Todos tienen en comun que se apoyan en el mismo servidor web: Apache. Yo, en mis inicios, siempre usaba soluciones basadas en Apache y Mysql. Pero cuando avanzas un poco y montas tu propio VPS, te das cuenta de que esta combinacion come muchos recursos del servidor web. Apache y Mysql son voraces devoradores de memoria RAM. Cuando no hay limite de recursos, pues estan muy bien. Pero cuando pretendes usar una Raspberry como entorno de desarrollo de sitios webs pues ya no funcionan tan bien. Y cuando tienes que tomar la decision de contratar un VPS, en el que sus caracteristicas son las que fijan el precio, tampoco.

  3. helpessayw.com

    on October 19 2020

    do my term paper custom essay order Ipibkc vlflvd

  4. expedp.com

    on October 20 2020

    non prescription viagra http://expedp.com/ Elwldz yyvvkn

  5. canadaxpha.com

    on October 21 2020

    canadian drug stores http://canadaxpha.com/ Rjvmds lirpay

  6. tadalarxpl.com

    on October 23 2020

    buy cialis online reddit http://tadalarxpl.com/ Yyusmt nlztab

  7. furosempi.com

    on October 23 2020

    lasix 20 mg http://furosempi.com/ Ztdrzx fxsqgn

  8. edtadx.com

    on October 23 2020

    generic cialis 20mg http://edtadx.com/ Dlqpii mjnsrt

  9. viagprsrx.com

    on October 25 2020

    tadalafil cialis http://viagprsrx.com/ Ocwrgd fbocgw

  10. viagsildcr.com

    on October 26 2020

    generic name for viagra http://viagsildcr.com/ Ufxoup cxxcga

  11. Ujarij

    on October 26 2020

    http://viagzaibis.com/ – online pharmacy viagra

  12. Oakees

    on October 30 2020

    http://tadalaed.com/ – cheap tadalafil Gxxahp nohndn

  13. Ffwixf

    on October 30 2020

    http://getadalarx.com/ tadalafil generique Ayeudd oynlbc

Comment RSS · TrackBack URI

Leave a comment

Name: (Required)

E-mail: (Required)




About FLT

This site is dedicated to everyone who likes to learn and explore the beautiful world of Linux. If you have comments and suggestions, please feel free to email at freelinuxtutorials@gmail.com. I am happy to serve and share things esp. that is free and enjoyable as Linux.