burke / webconfig
- Source
- Commits
- Network (4)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
afb0cfd
tree c7976f1307f4d996988e06cbb8b026779c4480ac
parent 980e27ed85bad12f84556d6a510d21442ed1f2b1
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Tue Apr 21 06:57:24 -0700 2009 | |
| |
README.md | Sat Apr 18 20:34:09 -0700 2009 | |
| |
bin/ | ||
| |
config/ | ||
| |
gen/ | Thu Apr 16 17:27:57 -0700 2009 | |
| |
lib/ | ||
| |
newdomain.rb |
Webconfig
Description
Webconfig is a tool to generate Virtual Host configuration files for web servers. I use it to manage Apache and Nginx, but I'm sure you could find additional uses for it. It parses a vhost specification file and generates the appropriate server configuration files based on the templates you define (or use mine).

Installation
Basically, just unpack this wherever you want. I like to keep it in /opt/webconfig.
How to use
Have a look at all the files in ./config/. templates.yml specifies all the different configuration templates you'll be plugging data into. It should make a whole lot of sense once you look at the file. Every template will have one or more "content_for_FOO" keys. When you run Webconfig, it concatenates all the content_for_FOO template content, with domain info interpolated, into gen/FOO.gen.conf.
The domain info is pulled from config.yml. I've provided config.sample.yml, which is a configuration I was using on my server at one point. Domains are listed with a number of parameters, each of which is translated into an instance variable before parsing the requested template for the domain.
defaults.yml contains values that should be included as instance variables every time a template is parsed. These will typically be things like server port numbers, etc., but again, you can use it for whatever seems useful.
Note that there's very little or no syntax checking on any of these config files. Be careful.
How to make your servers use the new configuration
For apache, find your httpd.conf. There's very likely a line that says something along the lines of "Include vhosts/*.conf". You can replace that with "Include /opt/webconfig/gen/apache.gen.conf".
For nginx, find your nginx.conf, and add a line somewhere in the http{ } block: "include /opt/webconfig/gen/nginx.gen.conf".
For other servers, you're on your own. Most configuration file syntaxes have some sort of include directive.
License
Released under MIT License by Burke Libbey / Chromium 53.

