pi Server Guide - Page 1 Web ServerThese 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 ApacheLet's first install Apache. SSH into your pi.
ssh firstname.lastname@example.org(Where xxx.xxx.x.xx relates to your pi's IP address)
sudo apt-get install apache2When that's finished, open up your web broswer, and navigate to the pi's IP address (e.g http://192.168.0.15).
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 PHPNow let's install PHP!
sudo apt-get install php5 libapache2-mod-php5Now 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-defaultFind the below and edit 'AllowOverride None' to 'AllowOverride ALL' as below..
<Directory /var/www>This will allow us to use .htaccess files (more on that later!)
Options Indexes FollowSymLinks MultiView
allow from all
sudo a2enmod includeTo 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.