If you're looking for a fast, lightweight web server that is scalable and requires very low memory, you should check out Monkey. (Honestly, how can you not want a monkey on your Linux server?) Monkey is not as powerful and feature-rich as Apache; it's better suited for small servers (even embedded systems) that only need to serve static content quickly and with little overhead (think self-contained kiosks and other such devices).

Monkey's features include:

HTTP/1.1

Virtual Hosts

Asynchronous networking model (event-driven)

Indented configuration

Plugins Support

C API Interface

Other features available through plugins include:

SSL

Security

Log writer

Directory Listing

Shell: Command line

Monkey works so efficiently by using a hybrid of posix threads and Epoll() system calls, with each thread capable of 200 concurrent requests. By itself, Monkey focuses strictly on static content. With the help of the Palm application server, Monkey can serve up dynamic content as well. The Palm application server is included with the Monkey installation.

Installing Monkey

The Monkey HTTP daemon is so easy to install that you can have the server up and running in a couple of minutes. Monkey can be installed from the Add/Remove Software tool (found in the default repositories of Ubuntu), or it can be installed from source. The installation from the Add/Remove software tool is self-explanatory, so I'll walk you through the installation from source.

Once you have settled your configure command, issue it and then follow it up with the sudo make and sudo make install commands. Monkey is now installed and ready to be started and configured.

Starting Monkey

Based on the configuration command issued above, I would issue the command sudo monkey -D to start Monkey in daemon mode. You can test Monkey by pointing your browser to http://ADDRES_TO_MONKEY_SERVER:2001 to see the Monkey splash page (Figure A).
Figure A

How can those smiling faces not bring you at least a moment of happiness?

Configuring Monkey

In the directory you defined as your sysconfdir, you'll see the monkey.conf file; this file is where all Monkey configurations are handled. In this file, you can configure things such as:

Port: Port Monkey listens on.

Listen: Restrict Monkey from listening to addresses.

Workers: How many worker threads to be launched.

Timeout: Span of time to wait to receive information.

Pidfile: Process ID file for use by Monkey.

UserDir: Directory name for users home.

Indexfile: Type of index files that are useable (such as index.html, index.htm, index.php).

User: The username the server should run under.

There are even more configuration options, so look through the file to see what needs to be configured for your needs.

Adding sites/pages

Based on the configuration command I ran, pages and sites are added within the /var/www/monkey directory. If I were to create a simple index.html page, place it into that directory, and point the browser to http://ADDRESS_TO_SERVER/monkey/, the index page would be displayed. But what if you want to make use of virtual hosts? That's right — this small and simple http server can also serve up virtual sites. In order to make use of virtual sites, you have to create a new definition file in the /etc/monkey/sites directory (which might change, depending upon where you define your sysconfdir in the configure command). Each definition file will require the following directives:

DocumentRoot: The root directory of the web server

Servername: The address (or name) of the server

At a bare minimum, that is all you need. You can compare any new virtual hosts file you create with the default file (aptly named "default"). What is really amazing about this little server is that you don't have to restart Monkey after creating a new virtual site.

Conclusion

Don't let Monkey's size fool you — it's agile, powerful, and scalable. Give this web server a try, and see if it can't take the place of your current web server.

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

Full Bio

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.