Web Server – A Child’s Play!

The world of web servers consists of two big names, Apache and Internet Information Server (IIS). These are the web server applications used in many of the servers that are part of internet. There is no doubt that both of these solutions are equally good and of enterprise quality. This article looks beyond the conventional web servers that we are aware of. We will get ourselves acquainted with one of the lightweight web servers available today.

As a developer you might have needed some kind of web server to test your application quickly. Or as a system admin you might have required to set up a quick and fast web server for a specific need. Now you could install and use the prevailing web servers like Apache or IIS to serve your purpose but the problem with this approach is, it will take considerable time (and optionally money) of yours, to set up them and get going. Thus the above two scenarios demands for a web server that can be quickly installed, configured and ready for use in almost no time!

Mongoose is a lightweight, easy to use and multi-platform web server. You can get the latest Mongoose web server from http://code.google.com/p/mongoose/
This is a single executable file for Microsoft Windows platform. It does not require any installation, just copy this binary to one of the folder. Also copy a sample configuration file from http://mongoose.googlecode.com/svn/trunk/win32/mongoose.conf. Place this file in same folder as that of Mongoose executable.
Now create a folder to hold your website content. Here is a sample setup for Mongoose:



Here www is the folder for website content. mongoose_error_log.txt and mongoose_access_log.txt are the log files created. Let’s modify mongoose.conf file to configure our web server. Following is the configuration file for the above setup:
------------------------------------------------------------------------------------
root            D:\mongoose\www
ports           80
access_log      D:\mongoose\mongoose_access_log.txt
error_log       D:\mongoose\mongoose_error_log.txt
cgi_interp    D:\wamp\bin\php\php5.3.0\php-cgi.exe
------------------------------------------------------------------------------------
Modify only entries listed above keeping all other options at default settings. If you want to enable PHP support for web server please mention php-cgi.exe path in cgi_interp. (This is an optional setting)
Now start the Mongoose web server by executing mongoose-2.8.exe
That’s all required to get your Mongoose web server going!
To stop the web server simply type CTRL+C and it will gracefully shutdown the server.
Mongoose is a wonderful lightweight web server solution and can be used in many applications without taking much of the available resources.

0 comments:

Post a Comment