mongoose: zero config http server

We already explored some options to share a directory quickly over http (like h2o and Boa) earlier. However, it seems like there are more interesting options. mongoose is a statically linked binary that can run on multiple platforms and share a directory in a few seconds over http. Continue reading mongoose: zero config http server

Script to share directory as webserver

terminalMy favourite tool to share a directory over http is boa. However, new options are always welcome, more so when it is a simple script. A developer has shared such a script that uses CGI to share a directory as a webserver.

To use the script and serve a directory as a HTTP server, run:

$ curl -L http://tinyurl.com/servesh1 | sh

The script is published as a GitHub gist and you can go thorugh it here.

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

Run a http server from any directory on Linux

cool_penguin_smallMany a time we need to share files over the LAN. There is a very simple way of doing it when you are on Linux using python2. cd to the directory the contents of which you want to share and run:

//Python 2
$ python -m SimpleHTTPServer 8181

//Python 3
$ pyhton3 -m http.server 8181

Here, 8181 is the arbitrary port number you want to use for your HTTP server. The files can now be accessed from any system in the LAN using a browser at

http://YOUR_IP_ADDRESS:8181

Another interesting utility is nweb.

Tested it between my laptop and mobile over the wireless and worked fine. Happy sharing!