Lighttpd and WordPress

Setup Lighttpd:

sudo apt-get update
sudo apt-get upgrade

Added reboots due to faults encountered.
sudo reboot

Install Lighttpd:

sudo apt-get install lighttpd php5-cgi

Install MySQL:

sudo apt-get install php5-gd mysql-server mysql-client php5-mysql

sudo reboot

Enter your MySQL password

Configure Lighttpd:

sudo lighttpd-enable-mod

You will see a prompt asking for the mod!


hit the enter key.

Now you will enter enable mod again!

sudo lighttpd-enable-mod

You will see the prompt again!


hit the enter key.
Restart Lighttpd:

sudo service lighttpd restart

Now we see if it is working!

sudo nano /var/www/index.php

Add this to the file.

Lighttpd working

Now CTRL-X then Y then Enter.

Restart Lighttpd:

sudo service lighttpd restart

Now open a browser and enter the RasPi's I.P. Address. You should see "Lighttpd working".

Now we need to enable mod-rewrite:

sudo nano /etc/lighttpd/lighttpd.conf

So we need to find "mod_rewrite"
There is a # in front of the line. Remove the # and insert a space so it lines up with the lines above.
CTRL-X then Y then Enter

Restart Lighttpd:

sudo service lighttpd restart

Configure vhost.

sudo nano /etc/lighttpd/conf-enabled/10-simple-vhost.conf

Change the default host name to your domain.

Remove the test index.php

sudo rm /var/www/index.*

Install WordPress:

extract WordPress:
tar -xvzf latest.tar.gz

Create working directory:
sudo mkdir /var/www/wordpress
Set permissions:
Change Directory
sudo chown -R www-data.www-data /var/www/wordpress

Copy the extracted files:
sudo cp -r ~/wordpress/* /var/www/wordpress

Below lines might be needed if you cannot enter the WordPress FTP when trying to install plugins or themes.

cd /var/www
sudo su
chown www-data *
chown www-data */*
chown www-data */*/*

sudo cp /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php

sudo nano /var/www/wordpress/wp-config.php

Change these lines.
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'user name');

/** MySQL database password */
define('DB_PASSWORD', 'password');

Configure MySQL:
mysql -u root -p
enter mysql password you create when MySQL was installed!

CREATE USER create a user name here;
SET PASSWORD FOR wordpressuser= PASSWORD('created password');

GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
sudo reboot

Now try your site by entering the IP
example; (The IP your Raspberry Pi shows at logon)

You should see the WordPress install page.

Site Title
Username (wordpressuser)
Password (user password)
Your E-mail
Box to let your site bee added to the search engines.

Press button to Install WordPress
Then you will log-in with your user and password.

Your WordPress site is now ready to be setup. You will want to choose a theme and start adding post or pages to your site!

Now we are going to install a couple of things to make your WordPress site run faster! you will notice that it takes quite a while to update or publish in your site.

Back to your keyboard or SSH!

Object cache for PHP:

sudo apt-get install php-apc

Now we will install XRDP so you can use the remote desktop. This only works if you use a full install of Raspbian.

sudo apt-get install xrdp

This will be your address to setup WordPress! when configuration is complete.

http://RasPi I.P./wordpress

I followed this guide, but modified it, mostly by adding sudo commands where needed.

free -m
total used free shared buffers cached
Mem: 232 120 111 0 9 57
-/+ buffers/cache: 53 178
Swap: 99 0 99

So Lighttpd uses about 88MB less than my Apache2 based WordPress server. Remember that I have more installed on this server than just a bare install of WordPress! WP Fast Cache is not installed either but the page serve speed is still decent.

Leave a Reply