I was searching for a lightweight but robust HTTP server which I can run with any arbitrary directory as root. And configuration should be as easy as possible. I found Boa. It is written in C with embedded systems in mind. Believe it or not, it’s just ~300KB in size! Here’s a step by step guide on how to install and use it on Ubuntu. The procedure should be similar for other Linux distros as well.
- Install boa.
$ sudo apt-get install boa
- Navigate to the directory which should be the http root.
- Copy the boa configuration file to the directory.
$ cp /etc/boa/boa.conf .
- Change the DocumentRoot.
DocumentRoot /var/www to DocumentRoot .
- Change ErrorLog and AccessLog configs to a location where you have access. You can also comment them out if it’s just a temporary server.
- Save conf and run boa with current directory as server root.
$ sudo boa -c .
If everything goes fine, your http server should be up and running by now. Run localhost in your browser to access your site. If you have a static IP and your router/firewall settings/ISP permit your friends can access your server over the internet as well.
Webpage: Boa
If you want to quickly make current directory to be served via HTTP you can use alias like
alias http=”python -m SimpleHTTPServer”
We did cover the Python option before:
http://tuxdiary.com/2012/02/14/run-a-http-server-from-any-directory/
Anyway, Boa is written in C and is suitable for Embedded Systems. It is way more efficient.