** Reply to note from "Steve Fairhead" <[EMAIL PROTECTED]> Sat, 20 May 2000
04:19:15 +0100
>
> James Smallacombe said:
>
> >> on an unrelated (to SSL) issue, is there a way to use a separate file
> (from httpd.conf) for virtual hosts? I STFW and didn't find anything,
> and tried doing $INCLUDE ala BIND and RADIUS and that broke the
> server. I need to make a script for adding virtual hosts, and it
> seems like it makes more sense using a separate file from httpd.conf,
> since any kind of parsing error in it kills the server... <<
>
> I do just this: in my virtual hosts section I have:
>
> Include conf/vhost.conf
>
> and in the SSL section I have:
>
> Include conf/vhost-ssl.conf
>
> Each file is resident in the same directory as httpd.conf (don't get
> fooled by the conf/ path).
>
> FWIW the standard Apache-modssl httpd.conf file contains examples of
> this.
This is more convienent, but still does not get around the problem of
killing the server if there is a syntax error in the configuration
file. Your best bet there is to make sure your script never allows a
syntax error to be generated. You can do this by being very careful
what choices you allow in the script, or by running httpd -t on the
generated configuration files, before you copy them to the live server.
Actually, if you are going to the trouble of writing a script, maybe
you should do both.
Your script could create a newconf/httpd.conf and related files then
run apache like:
httpd -f /where/ever/newconf/httpd.conf -t
This will look in the newconf directory for a set of configuration
files and attempt to parse them. You can check the return value of the
program to see if there are errors, if there are you probably need a
human to debug the configuration before you implement it. If there are
no errors, you can
mv newconf/* conf
then restart your live server.
Another way to separate the VirtualHost information from the rest of
the apache configuration is to use the fact that apache will now allow
any configuration option in any of the three files it parses at
startup. I place my general configuration options in httpd.conf, and
all of my VirtualHost blocks in access.conf.
I may have a problem if they ever decide to eliminate the extra files,
but for now it is very convienent. I can generate all the VirtualHost
information from a database and create a file, ignoring all the other
settings that are in httpd.conf. (My policy is to regenerate the
entire access.conf file from the database each time a change is made.
This makes for a simple script, as you setup the database to reflect
the settings you want, then run a script to generate the entire file.
Rick Widmer
http://www.developersdesk.com
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]