Overview
What apache is happy to do:
Include /etc/http.d/conf.d/*.conf
As you know this includes every *.conf file in the /etc/httpd/conf.d directory, which is fine but it would make more sense for it to be able to do this.
Include /var/sites/*/vhost-staging*.conf
This would then look in each web app directory and find out if there was a conf file that matches vhost-staging*.conf, this would then match.
/var/sites/app1/vhost-staging-app1.conf /var/sites/monkeys/vhost-staging-monkeys.conf /var/sites/badger/vhost-staging-badger.conf
Which would mean that we would no longer have to maintain the /etc/httpd/conf.d/ files manually, which would not only be easier from a maintenance point of view but would mean the config stays with the project which is really where it belongs.
Unfortunately apache doesn’t do this, but after a lot of creative solutions, I found others had this problem and there’s a patch to just make apache do it. It does mean compiling apache from source, but it’s not at all difficult.
Solution
- Dowload the apache source
- Untar the tarball
- Download the 2 patches to the appropriate location
- Apply the patches
- Compile the apache source as normal
lynx -source http://www.mirrorservice.org/sites/ftp.apache.org/httpd/httpd-2.2.19.tar.bz2 > /opt/apache/building/downloads/httpd-2.2.19.tar.bz2 tar jxvf /opt/apache/building/downloads/httpd-2.2.19.tar.bz2 -C /opt/apache/building/source lynx -source 'https://issues.apache.org/bugzilla/attachment.cgi?id=22328' > /opt/apache/building/source/httpd-2.2.19/server/Includes.diff patch -p0 -d /opt/apache/building/source/httpd-2.2.19 -i /opt/apache/building/source/httpd-2.2.19/server/Includes.diff lynx -source 'https://issues.apache.org/bugzilla/attachment.cgi?id=22325' > /opt/apache/building/source/httpd-2.2.19/srclib/apr/strings/Apr.diff patch -p0 -d /opt/apache/building/source/httpd-2.2.19/srclib/apr -i /opt/apache/building/source/httpd-2.2.19/srclib/apr/strings/Apr.diff cd /opt/apache/building/source/httpd-2.2.19 ./configure ...
I’m going to follow up this post with a series of posts on how we now manage apache confs, especially with Symfony2 projects.




