This repository was archived by the owner on Jul 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Home
johnbintz edited this page Sep 14, 2010
·
6 revisions
Have a lot of Apache sites to manage? Hate duplicating the same content over and over again between configs? Want to ensure your Rewrites work as you expect them to? apache-config-generator is the tool you need!
Looking for RDoc Documentation?
gem install apache-config-generator-
cdto where you want to store your configs apache-configurator new-configs- Create a replacement httpd.conf:
Include /path/to/new-configs/conf.d - Create a new config in
configs/httpd.rb:
Apache::Config.build('httpd.conf') do
modules :expires, :headers, :rewrite, :deflate,
server_root '/var/www'
server_name 'my.web.server', 'my.other.name'
document_root '/var/www/my-site'
directory_index! 'index.html'
enable_gzip!
directory '/' do
allow_from_all
end
end- Regenerate your configs:
rake apache:create - Restart your server
- On large or legacy installations, managing lots of config files with duplicated content becomes unwieldy. Keeping your configs DRY is just as important as keeping code DRY.
- Since there are often very few changes between staging and live server with regards to actual config, you can maintain one master set of files and only have the appropriate sections (access controls, server settings) change based on the environment in which the configs are being generated.
- It beats writing pseudo-XML.
Feel free to fork the project and do whatever you need to do to fix a bug and send me a pull request when you’re done. Use GitHub’s bug tracker to report any problems.