Proudly hosted on a Rasberry pi

pi Server Guide - Page 1 Web Server

These guides assume you know your way around a computer, are comfortable with the CLI and have some GNU/Linux knowledge. I accept no blame if you make your pi implode.
So you've got your pi? You've installed your OS? Here's a guide to set up a Web Server on this bad boy!

Step 1 - Install Apache

Let's first install Apache. SSH into your pi.
ssh pi@xxx.xxx.x.xx
(Where xxx.xxx.x.xx relates to your pi's IP address)
sudo apt-get install apache2
When that's finished, open up your web broswer, and navigate to the pi's IP address (e.g
If that worked, then great! You've got the basics of a server running!
The default directory for web files is /var/wwww, this directory and it's contents are defaulted to being owned by root. You need to take ownership of the directory before writing files to it.
sudo chown user:group /var/www
(Where user and group relate to your user and group, default pi:pi)
Now you can crack on and copy your website over to /var/www and viola, it is there for the world to see. Well, the whole of your home network anyway.

Step 2 - Install PHP

Now let's install PHP!
sudo apt-get install php5 libapache2-mod-php5
Now we need to make some modifications to the apache config, and enable a module so that we can use Server Side Includes.
sudo nano /etc/apache2/sites-enabled/000-default
Find the below and edit 'AllowOverride None' to 'AllowOverride ALL' as below..
<Directory /var/www>
Options Indexes FollowSymLinks MultiView
AllowOverride ALL
Order allow,deny
allow from all
This will allow us to use .htaccess files (more on that later!)

sudo a2enmod include
To enable the include module in Apache.
There we go, a basic web server w/ PHP on your pi! All you need to do is forward port 80 on your router to your pi's LAN IP address and the world can see your creations (More on this in a later chapter)  

Go have a beer and congratulate yourself.