Configuring Virtual Hosts

3.2. Configuring Virtual Hosts

For Monkey, every content belongs to a virtual host. Each Virtual Host is defined in a configuration file under conf/sites/ directory. Thus, a minimal web server equals to having only one virtual host; for that end is required the existence of at least one virtual host definition-file called 'default'.

Each virtual host file must contain a [HOST] section and can have the following entries:

DocumentRoot

This is the principal configuration file, it describes the server setup and different variables such as number of workers, TCP port, timeouts, etc.

DocumentRoot /var/www
Servername

Sets the the virtual host identifier (e.g. mysite.example.com).

Servername 127.0.0.1

Like a Tip, you can experiment with virtual hosts in the local machine by adding lines to your /etc/hosts file, for example:

127.0.0.1   mysite_1
127.0.0.1   mysite_2

Then, if you start your web browser and go to http://mysite_1 you get one thing, and going to http://mysite_2 another (assuming you've defined diferent contents for them)