This site is now running on Apache 2 on Debian. The last time I used apache 2 it was an early release and the configuration structure and methods was almost identical to the 1.* series.
The current version uses similar directives, so implementing vhosts (virtual hosts) has not changed that dramatically, however the actual method for configuring them has.
Under the Apache 1.3.29, for example, all directives were contained in httpd.conf, whereas with apache 2 that file is completely blank. I found that a little bit confusing at first 🙂
So how do you actually do it?
It’s not that hard 🙂
The configuration directory (on my system /etc/apache2/conf ) contains a number of files and directories.
In apache2.conf , which in debian is in /etc/apache2, there is an include directive:
Include /etc/apache2/sites-enabled/[^.#]*
If you look in the same directory you will see that there are two sub-directories:
sites-available
sites-enabled
The idea is very simple. You create a small configuration file for every site you wish to host and place them in sites-available. To make the site active you simply symlink it in sites-enabled and restart apache (a graceful restart might be better, but it caused problems the last time I tried it)
If you want to disable a vhost simply remove the symlink and restart apache2.
This is an interesting way of doing things in my opinion, as you can easily “play with” configuration directives and activate/deactivate them very quickly.
The various apache modules are handled in exactly the same way:
/etc/apache2/mods-available – apache modules installed on the system
/etc/apache2/mods-enabled – apache modules in use
You no longer need to worry about fiddling with the load directives in the .conf, you simply symlink in a modules .load file eg. foo.load, to enable it and delete the symlink to disable it.








Leave a Reply