We have several different environments (developer dekstop, integration, QA, prod) which should have slightly different variants of the same httpd.conf file. As an example, the httpd.conf file configures that httpd should act as a reverse proxy and proxy certain URLs to Jetty, but the hostname of the Jetty instance is different in each environment.
Is there a recommended practice for mangaging these kinds of differences? I looked around the apache documentation for the httpd.conf file and I didn't see anything that does what I need.
Split the unique sections into separate files, then use
Include
directives in the main http.conf to include other config files. You could for example wrap those Includes inIfDefine
sections and then use the-D
command-line startup option to define variables to turn on or off different sections of the config:and then:
It feel cleaner to me to use included conf files, but of course you could put all your config in one file inside ifdefs too.
Bonus points for automating all of this with a config management tool like cfengine or puppet, of course.