Here's what I do, with a template config file that contains the
below.

The httpd.conf is "static" in that it contains only global
info for the host.    Only the most basic info for the site
is included in httpd.conf, as I want to push it out (via n1sps)
as a template.

Then I "include" the file below, which contains the Section #2
"base" Name Virtual Host for the system, so there can always be a default
server running, to do things like errors/images/etc.

The Section #3 is a Name Virtual Host that is running as well.

"Include" a new Section #3 per Name Virtual Host you wish to assign.

You could also use an Apache2 resource directory, calling the appropriate
vhost file by installing it there.

You have to have a matching name for the vhost in the DNS, or
you need to use an IP based Virtual Host, which is beyond the scope
of this article.

Likewise, I break ssl.conf into a "globals/default" file and then
call up a separate vhost-ssl file as required (with IP based vhost).



#
#  Section 2: Common server configuration
#

Alias /livery/ "/opt/app/cwis/common/data/livery/"
Alias /errors/ "/opt/app/cwis/common/data/errors/"

ErrorDocument 400 /errors/badreq.php
ErrorDocument 401 /errors/authreq.php
ErrorDocument 403 /errors/forbid.php
ErrorDocument 404 /errors/notfound.php
ErrorDocument 410 /errors/gone.php


NameVirtualHost *:80

<VirtualHost *:80 >
ServerName  server.net.foo
ServerAdmin [EMAIL PROTECTED]
DocumentRoot "/opt/app/cwis/common/data"
ErrorLog /var/cwis/logs/common/error_log
CustomLog /var/cwis/logs/common/access_log combined

ScriptAlias /cgi-bin/ "/opt/app/cwis/common/cgi-bin/"

<Directory "/opt/app/cwis/common/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/opt/app/cwis/common/data">
     Options -Indexes FollowSymLinks
     AllowOverride None
     Order deny,allow
     Allow from all
     Deny from env=nastyrobot
</Directory>

</VirtualHost>

#
#  Section 3 : Name Virtual Host configuration
#


<VirtualHost *:80 >
ServerName server2.net.foo
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /opt/app/cwis/pubapps/data
ErrorLog /var/cwis/logs/pubapps/error_log
CustomLog /var/cwis/logs/pubapps/access_log combined

ScriptAlias /cgi-bin/ "/opt/app/cwis/pubapps/cgi-bin/"

<Directory "/opt/app/cwis/pubapps/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

<Directory "/opt/app/cwis/pubapps/data">
     Options -Indexes FollowSymLinks
     AllowOverride None
     Order deny,allow
     Allow from all
     Deny from env=nastyrobot
</Directory>

</VirtualHost>
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to