Apache virtual host config

Charles Steinkuehler charles at steinkuehler.net
Sun Jun 22 12:09:13 CDT 2003


Kendric Beachey wrote:
> Any apache wizards out there?
> 
> I'm trying to get this machine to serve web pages for two URLs even though the 
> two domain names resolve to the same IP address.  This should be possible 
> using apache 1.3.27, using this in the config file:
> 
> 
> ################# Named VirtualHosts
> NameVirtualHost *
> <VirtualHost *>
> ServerName www.beachey.org
> ServerAlias beachey.org *.beachey.org
> DocumentRoot /home/httpd/htdocs
> </VirtualHost>
> 
> <VirtualHost *>
> ServerName www.jocojedi.org
> ServerAlias jocojedi.org *.jocojedi.org
> DocumentRoot /home/httpd/htdocs.jocojedi
> </VirtualHost>
> 
> 
> Shouldn't it?

Yes, and the virtual hosting *IS* working (or you'd get exactly the same 
web content for both URLs).

> At the moment www.beachey.org is working fine (as it was when it was the only 
> game in town) but www.jocojedi.org just gives a 403 Forbidden for anything 
> you request.
> 
> The contents of /home/httpd/htdocs.jocojedi are:

<snip>

> ...which looks kosher to me, and looks just like the users/groups/permissions 
> in /home/httpd/htdocs.
> 
> If there's any other information you need to see, let me know...

You probably need another directory stanza in your apache config.  Most 
default apache config files typically include a "deny all" access policy 
to any directories you don't otherwise specifically allow access to.

The /home/http/htdocs directory is probably explicitly allowed by your 
default config file, but /home/httpd/htdocs.jocojedi is not.  I bet if 
you add an appropirate directory section to your apache config, the 
jocojedi site will start working.

I typically like to lump the directory stanza into the virtual host 
definition, so I remember to change it if I start moving directories 
around...something like:

<VirtualHost *>
   ServerName www.jocojedi.org
   ServerAlias jocojedi.org *.jocojedi.org
   DocumentRoot /home/httpd/htdocs.jocojedi
   <Directory "/home/httpd/htdocs.jocojedi">
     Options Indexes FollowSymLinks
     AllowOverride None
     Order allow,deny
     Allow from all
   </Directory>
</VirtualHost>

-- 
Charles Steinkuehler
charles at steinkuehler.net




More information about the Kclug mailing list