Wednesday, February 20, 2013

Raspberry Pi as webserver

Now I want to setup a small webserver on my raspberry pi. First we have to choose an appropriate lightweight webserver, because a standard Apache installation seems to big & overkill.
Two small webserver, which seem to be very good and also widely used are:
I heard a lot of good things about nginx, mainly its speed and rewriting abilities, but I decided to use lighttpd just because I found good instructions for it first. Installing:
 sudo apt-get install lighttpd
sudo nano /etc/lighttpd/lighttpd.conf
Check that the following modules are enabled:
server.modules = (
The web root dir should be "/var/www/" and the user which runs lighttpd is "www-data" - no need to change anything here.
Lighttpd should be already running. You can start/stop/restart the service with:
sudo /etc/init.d/lighttpd start
sudo /etc/init.d/lighttpd stop
sudo /etc/init.d/lighttpd restart
Now create a file "/var/www/index.html" with some html code, open a Browser and go to "http://<yourIP>/index.html". VoilĂ .

No comments: