Now everybody knows itâs way smarter to just pay someone to host your website. But what not everybody knows is that itâs way more punk rock to Do it Yourself. So what follows are some tips / pointers / instructions for setting  up your own home webserver (which will burn a scant 2 watts) using all free, open source software, a Raspberry Pi, and your home internet connection.
The emphasis here is on lightweight, which fits well with the Raspberry Pi. Sure, you can setup a blog with wordpress or Django, and they will run (Iâve tried it, at least with Django). But they probably will run rather slowly. Why? The rPi doesnât have a lot of memory or processing power, and a database / front end model requires a decent amount of that. If your site / blog ever gets much traffic, itâll likely buckle under the load. The answer? Just serve up plain old static HTML pages. Itâs fast, secure, simple, and easy on the rPiâs limited resources. But rather than painstakingly handcodeing each new blog entry, you can use a static html generator like Pelican to make it easy.
Here are the hardware ingredients:
1) A Raspberry Pi (with power supply and SD card)
2) A computer with an SD card reader (or a USB stick SD card reader)
3) A simple home network, shared by your computer and the rPI. If you have a router and an internet connection, youâre golden. The rPi will need to be connected via ethernet, so you might need a cable.
Here are the main software ingredients:
1) The standard Raspberry Pi Linux âRaspbianâ operating system, based on Debian.
2) Lighttpd, a lightweight web server, thatâs pretty easy to setup.
3) Pelican â a static html blog generator (you can also use something like Octopad, if you prefer.)
4) PageKite â a âlocalhost tunneling solution,â which I found to be much better than dynamic DNS.
Human requirements:
1) Some linux know how, or
2) A friend with some linux know how, and / or
3) Know how to use forums to ask for help, and
4) Patience
This instructable wonât be comprehensive, but it will point you to the resources / places to get help if you need it.
Step 1: Setup your rPi
First you need to setup the SD card on your rPi. On this little computer, the SD card is your hard drive. It needs an operating system so you can boot and run your rPI, and tell it what software to run to serve your site.
Check out the getting started guide here:
http://www.raspberrypi.org/quick-start-guide
Youâll be installing the latest âRaspbianâ SD card image from here:
http://www.raspberrypi.org/downloads
Follow the instructions to download the image and install it on your SD card.
Now, if you have a monitor, keyboard, and mouse that you can use to run your rPi, youâre set. If you donât, itâs ok â you can still set things up from the command line in whatâs called âheadlessâ mode. To do that, youâll need to âSSHâ into your rPi through the network connection shared by it and your computer. Hereâs a great tutorial that explain how to do that:
http://www.penguintutor.com/linux/raspberrypi-headless
Do run the Pi setup script when prompted.
Youâll want to change the default password! If you leave the username as âpiâ and the password as âraspberry,â you will be pwned. Change it now to something strong â web servers are exposed to the big bad internets, so youâll want to be security conscious.
Step 2: Setup a static IP, then install a webserver
Now youâll want your rPi to have a static IP address on your local network. Most networks use DHCP by default. Thatâs a system where the router gives out an available IP address when asked by each computer. Itâs easier to setup your rPi to ask for the same IP every time. Hereâs another good tutorial from penguin tutor on how to set that up:
http://www.penguintutor.com/blog/viewblog.php?blog=6306
Once you have a static IP, install the webserver!
Itâs very easy to install software on Debian (and Raspbian is just Debian optimized for the pi), because pretty much all the software you need is available in the Debian software repositories.  So just open a terminal and type:
sudo apt-get install lighttpd
Lighttpd (pronounced âlightyâ) is a lightweight open source web server. Its job is to listen for requests from the internet on the http port â port 80. When it receives a request, it sends back the requested webpage data.
Once lighttpd is installed, you should be able to see a startup web page by typing your rPiâs IP address into your browserâs address bar. For example, if you chose 192.168.1.20, you just type that into your address bar, and lighttpdâs default webpage will come up. (If it doesnât at first, try rebooting your rPi: sudo reboot )
Step 3: Pelican, a static html blog generator
Pelican is an awesome static html makinâ blog engine. What does that mean?
It means that once you set it up, you write blog posts in your favorite text editor, place them in a special folder, and then run Pelican. It then converts your text files into a simple HTML website on your computer. You then copy those files to your rPi server, and your viewers will be able to navigate through your posts. You can even choose different themes.
Pelican setup is described here:
http://pelican.readthedocs.org/en/3.0/getting_started.html
Youâll need to first get python  â the programming language in which Pelican is written and on which it runs â installed on your computer. The good news is that there are good instructions on how to do that on the webs. It might already be on there!
http://wiki.python.org/moin/BeginnersGuide/Download
The simple theme that comes with Pelican is pretty good, but there are a few others to choose from (see links on the site). You can also roll your own if you have some html / css chops.
Once youâve generated your blog, youâll want to copy it to your rPIâs /var/www directory â thatâs the directory where Lighttpd looks for html pages to serve when it gets http requests. Pelican has lots of handy utilities to make that easy, including synching through drop box, or copying the files via ssh.
Step 4: Setup PageKite
When I first setup my rPi server, I tried using Dynamic Dns (through NO-IP.com) to make it work. It didnât. The reason was that my ISP, RCN cable, blocks all incoming requests on the http port â port 80. I thought that since No-IP has a service that will redirect those requests to another port of my choice (I used 8080), thatâd Iâd be ok.
But this had the very bad effect of making the non-standard port # I chose appear in my URLs. So when visiting my site, instead of seeing:
http://amosamos.net
in the address bar, the viewer would see:
http://amosamos.net:8080
Thatâs enough to freak out most parents, grandmothers, and folks who are liable to get freaked out by the webs and viruses and hackery. I could avoid this by paying my ISP $20 more a month for a static IP, but that seems like a lot to hose a simple blog. I like them, for the most part, but not that much.
Luckily, a friend told me about PageKite. PageKite allows you to install their app â written in Python â on your webserver. It keeps in contact with PageKiteâs front end servers. So when a request to view your website comes in, it gets forwarded from the PageKite servers, through a âtunnelâ to your rPiâs localhost port 80. So thereâs no need to use Dynamic DNS to keep track of what IP address your ISP has assigned you today, or hop around the blocks they may or may not have installed.
PageKite is pay what you want, and the suggested rates are very low (~$3 / month).
Step 5: W00t! Homegrown WebsâŠ
Now send your url to all your pals, and fill the internets with your homegrown, homeserved wisdom. đ
Next steps?
* Setup your rPi to use autoupdate. That means that it will install security patches / updates automagically, to ensure that any security holes get plugged up quick. Hereâs a great tutorial:
http://www.howtoforge.com/how-to-configure-automatic-updates-on-debian-squeeze
* Make your rPi run on solar power, so you can serve solar powered content round the world. (You only need around 2 watts!) Then make an instructable!