Sorry for the duplicate.  I kinda screwed up the threading for the message
last time.

.---- + webguy mumbled...
| I was just wondering if a) there is a way to make a separate conf file
| for virtual hosts, or b) someone has a script for appending new virtual
| host entries to the end of the httpd.conf file.  This is because my file
| is 1000 lines long and it's a bit of a pain to have to scroll all the
| way down everytime I add something. Thanks!
| Chris
| -- 
| Chris Blessing
| [EMAIL PROTECTED]
| http://webguy.dCaff.com
`--------------- +

Use the Include directive liberally.
On our primary business webserver, running Apache-1.3.4 with mod_ssl, the main
apache config file (which loads all the others) is still
/var/www/conf/httpd.conf, and it loads all the others with:
Include conf/filename.conf

Other files my httpd.conf Includes are:
   conf/access.conf, I liked to keep my access control blocks in their own file,
      not in httpd.conf
   conf/vhosts/(domainname.com), for VirtualHost blocks for each domain hosted
   conf/ssl.conf, for initial setup of the mod_ssl drivers
   conf/ssl-vhost-template, which each SSL-enabled VirtualHost block then
      includes to enable SSL support for that virtual host.

The total number of lines for all my config files (about 40 in all) is 1300,
and the largest single file is 300 lines (httpd.conf)

As for the vhost files, I have a single template file (conf/vhost-template)
that has tags in it that are replaced using a sed regex search/replace command.
Example:
<VirtualHost _VHOSTNAME_>
User _USERNAME_
Group www
ServerName _VHOSTNAME_
DocumentRoot /var/www/vhost-root/_USERNAME_/_VHOSTNAME_/htdocs/
ScriptAlias /cgi-bin/ /var/www/vhost-root/_USERNAME_/_VHOSTNAME_/cgi-bin/
TransferLog /var/www/vhost-root/_USERNAME_/access._VHOSTNAME_
ErrorLog /var/www/vhost-root/_USERNAME_/errors._VHOSTNAME_
ServerAdmin _USERNAME_@_VHOSTNAME_
</VirtualHost>

the tags are self-explanatory, and the basic sed search-replace command could
be put into a script, and looks something like:
bash# cat vhost-template | sed -e 's/_VHOSTNAME_/newdomain.org/g' -e \
   's/_USERNAME_/joesmith/g' > vhosts/newdomain.org
Then you'd just Include the new vhost config file by adding in httpd.conf:
Include conf/vhosts/newdomain.org

This is an oversimplified version of my template, but it should work in this
form with little or no modifications.

(also, multiple levels of Includes will work just fine, ie.
"Include conf/vhost.conf" in httpd.conf, and Include all your vhost domain
configfiles into conf/vhost.conf)

- Erik Schorr
- Communications World Network
- erik-lists @ demon . cwnet . com

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to