I've been on various different VPS servers and they sometimes automatically setup separate conf files for each virtual host.

I'm trying to achieve the same on my local machine (that runs Ubuntu 11.04 on xampp 1.7.3). How would you go about doing this. Would you edit the http.conf file? Does apache already does this automatically?

How would one setup separate .conf files for each virtual host in a specified folder (say /opt/lampp/etc/extra/hosts)?


You can include a directory of config files by adding a line like this to the bottom of your apache2.conf / httpd.conf file:

Include /opt/lampp/etc/extra/hosts/

Where /opt/lampp/etc/extra/hosts/ would contain the conf files.

The conf files would each look like a normal virtual host definition:

<VirtualHost *:80>
ServerName foo.dom.com
ServerAdmin admin@dom.com
DocumentRoot /path/to/docroot

(etc, etc)

That behavior is typical of a Debian installation where config files are split into smaller, more manageable files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.