Bringing Apache virtual hosts and and conf together

With Apache 2.4 the configuration structure of apache changed. In the configuration folder of apache there are now subfolders

  • conf
  • mods
  • sites

The mods folder is quite clear. With links in the enabled folder the modules can be activated.

Most web application like phpmyadmin, wordpress, owncloud, svn put their configuration like in apache 2.2 to the conf folder.

I’m using virtual hosts on my apache with only one IP. Especially I use also SSL with virtual host using SNI. The setup is described here.

If I enable now the configuration files of my web applications in the conf folder using links, the web applications are available on every virtual host and/or site. But in fact I would like to have the mail application enabled only on the mail virtual host, phpmyadmin on the db virtual host and wordpress and owncloud on the www virtual host.

To achieve this it is possible to copy the configurations to the virtual hosts.

But in fact there is a much simpler solution: Don’t add links to the conf-enabled folder to enable the configurations. Instead add lines like “Include conf-available/wordpress.conf” to the virtual host configuration.

Leave a Reply