Serving up your Static website on the Raspberry Pi is a relatively straightforward task when you leverage a simple web server.
For this purpose I have used nginx due to my happy experiences with it before. I'd found it to be a very fast web server and one of the simplest I've experienced in terms of setup.
Any static website will do, if you want to try a Python based Static Content Management System to generate the site, have a look at the previous post on using Lektor
This page also assumes your website content resides on your Pi at ~/web-dev/0xc4d4.github.io
(see here for the lektor publish summary if your using that)
However, a single hello world type html page will do !
So, get the nginx web server first (alternatives might be lighttpd (lighty), apache, etc )
sudo apt-get install nginx
Now go to the nginx available configurations folder and tell it how to serve up your static data by pointing it to the folder it resides in
cd /etc/nginx/sites-available/
sudo cp default default.0xc4d4.github.io
sudo pico default.0xc4d4.github.io
(vi or any other editor will do, I assume pico is easier for beginners)
Set the content of the file as follows. Note the major pieces are
server {
listen 81 default_server;
listen [::]:81 default_server;
root /home/pi/dev-web/0xc4d4.github.io/;
index index.html index.htm
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
Now, to enable this new configuration so nginx present it when asked, we have to make this configuration available in the sites-enabled folder. Instead of copying it, we can just link it:
cd ../sites-enabled
sudo ln -s ../sites-available/default.0xc4d4.github.io
Then just restart the web server with:
sudo service nginx stop
sudo service nginx start
And point your web browser to http://<the Raspberry Pi's ip address :D>:81/ (e.g. http://192.168.1.4:81/ )
For a static, mostly text, website, the responsiveness is excellent on my Raspberry Pi model B served to my laptop over 5G WiFi at a distance of <10m.