My Raspberry Pi was finally delivered last week and I’ve had a chance to play. Here are some notes on how to configure it as a simple Web Server.

The first thing I did was to check for updates and configure SSH. I don’t want it connected to a monitor and keyboard all the time. I use DHCP so there was no need to faff about with static IP Addressing and DNS. SSH is disabled by default so I enabled it as follows;

sudo apt-get update
ssh-keygen -t rsa
sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc
sudo /etc/init.d/ssh start

Source: http://elinux.org/R-Pi_Troubleshooting#Cannot_ssh_in_to_Pi.

I decided to use Nginx rather than Apache as it’s faster and I guess better suited to a device such as this.

sudo apt-get install nginx

The only config changes required to the Nginx config was to comment out the line for listening on ipv6. This was preventing Nginx from starting.

Comment out # listen[::]:80 default ipv6only=on

vi /etc/nginx/sites-enabled/default

I then installed PHP and fastCGI

sudo apt-get install php5-common php5-cli php5-suhosin php5-cgi spawn-fcgi

Further changes were required to /etc/nginx/sites-enabled/default as well as following the excellent instructions from here to configure FastCGI. I used the TCP Sockets Configuration Example.

Once I’d started php-fastcgi and restarted Nginx I created a simple info.php to confirm everything was working, which it was, happy days :-).

< ?php
phpinfo();
?>

Tags: , , , ,

Leave a Reply