Share a directory quickly on Ubuntu using Boa webserver

by -

When comes to HTTP servers, there are many options to choose from. Apache and Nginx are two of the most well known names. Boa is a lesser known lightweight (only ~300 KB) webserver that delivers good performance. Unlike traditional webservers it doesn’t create a new fork for each connection, or, in other words, it is a single-tasking HTTP server. It has a light memory footprint and makes it suitable for running on embedded devices. Configuring Boa is also easy.

Boa runs on desktops too. Let’s say you want to share a directory from your Ubuntu system with your colleague in a remote branch with a Microsoft Windows system but on the same office network. The files are bigger than your email attachment limit and your colleague needs to choose several files from the directory as per his needs. Boa can be a handy choice in situations like this where you would like to share a directory quickly over HTTP. Of course you can choose other options like Apache but Boa merely takes a minute to install, setup and share any directory over HTTP. This guide will show you how to do that on Ubuntu.

  • Step 1: Install Boa
    It is available in the default repositories on Ubuntu. Run the following command to install it –

    $ sudo apt-get install boa
  • Step 2: Navigate to the directory which you want to share.
  • Step 3: Copy the configuration (boa.conf) file to the directory:
    $ cp /etc/boa/boa.conf
  • Step 4: Change the DocuementRoot entry in boa.conf to point to the current directory:
    DocumentRoot /var/www
    to
    DocumentRoot
  • Step 5: As it is a temporary server, you can comment out the ErrorLog and AccessLog entries in boa.conf.
  • Step 6: Save the configuration file and run the server with the current directory as root directory of the server:
    $ 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. Works great in a LAN environment. If your router/firewall settings/ISP permit, your friends can access your server over the internet using your real IP address as well. You can check your real IP at whatismyip.

Comments

Loading Facebook Comments ...
Loading Disqus Comments ...

1 COMMENT

  1. Thanks for sharing this.Having another option is good, but python should be installed and all you have to do is.
    python -m SimpleHTTPServer port
    For example.
    python -m SimpleHTTPServer 8080

Leave a Reply