Apache VirtualHosts

I find it useful to keep them in different files for a couple of reasons:

  • Temporary web sites can be easily added or torn down without touching my production sites. For example, I was playing with the Omeka content management system. By keeping it in a separate file, I don’t have to determine what belongs to Omeka (e.g., Directory directives) and what belongs to my production site.

  • You can use the “a2en…” and “a2dis…” tools to change the configuration. Using the example above, I could a2dissite omeka on my Ubuntu based system and it will remove the link in /etc/apache2/sites-enabled. I could put it back with a2ensite omeka later. (You also have a2enmod and a2dismod for modules, etc.)

The logical separation enforced by using different files, though, mostly protects me from my future self that has forgotten half of what I did. And I need all the help that I can get for that.

1 Like