RPi webserver

Introduction
The board may not look that powerful but there is more than enough grunt to run a small web server supported by php and mysql. I have not covered this here but have also installed wordpress on the server and runs very well too.

This HOWTO is based on the Debian build and has been tested on the first and second release.

Please note you are required to check security setting and access to the server, this is a guide on getting to the first point of having a working server and first few pages.

Installing Lighttpd
Lighttpd is one of the smallest web server around and ideal for the raspberry Pi as its uses very little memory.

First you need to set up a group and user that the web server can use: Next run the install, this will take a few moments: You can check that the server is installed correctly by typing:

The main web server is now installed and can be checked by opening a browser and entering the address of your server and checking Lighttpd's default information page:

NOTE: Your web sites files are located at /var/www/

However you will also need php and mysql to get the best out of a web site...

Installing php5 and mySQL
This is much bigger than the web server alone so is going to take some time to download and install... for me it was around 10 mins.

These can both be installed in one go by running the following:

NOTE: During the install you will be asked for a password for accessing mySQL with. As this will be for root access I suggest something you will not forget! You will need it again at some point!

The apt-get program will have left the downloads on your server and these take up space. If you want to remove them (as its now all installed) you can run the following to remove all apt-get download files:

Configuration of Lighttpd
So as to access the php server your web server needs to know where its installed. I'll also add a Error 404 handler as there is nothing worse than a visitor getting a Error 404 from your site!

To turn on the cgi mod of the server type the following:

I think this did more than create a configuration file but found I had to remove the mod and add the php setting directly in the Lighttpd configuration file as follows:-

First remove the cgi reference in the cgi config file by adding a '#' to the start of the line. Edit the file as follows:

change line to read as follows:

To 'SAVE' changes press Ctrl-O and [enter] followed by Ctrl-X and [enter].

Now edit the main configuration files as follows:

Add the following line to the server modules section:

Add the following to the end of the file: To 'SAVE' changes press Ctrl-O and [enter] followed by Ctrl-X and [enter].

The first line added enables the cgi module, the second points to the php-cgi server if a .php file is accesses and the last is our Error 404 handler.

You can set the file names to any page you want, I just set it to index.html as a default.

Last thing to do in the configuration is to restart the server as follows:

Setting Up and Test
I would suggest you may want to check the php service is working ok by creating a quick .php file:

And add the following lines:

Now as before use a browser to open your raspberry pi and access phpinfo.php