Boa: quickly run a http server on any directory

cool_penguin_smallI 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
    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

6 thoughts on “Boa: quickly run a http server on any directory”

  1. If you want to quickly make current directory to be served via HTTP you can use alias like

    alias http=”python -m SimpleHTTPServer”

Leave a Reply

Your email address will not be published. Required fields are marked *