[ale] Back to needing direction on virtual hosts again. :(

Jeremy T. Bouse Jeremy.Bouse at UnderGrid.net
Thu Apr 26 15:42:33 EDT 2007


Jim wrote:
> Jerry Yu wrote:
>> Jim, like Warren said, you need one separate 
>> <virtualhost></virtualhost> section per virtual host which has 
>> different DocumentRoot.
>> For those virtual hosts who share a common DocumentRoot, they can be 
>> accommodated with serverAlias (?) directive inside a single 
>> virtualHost section
>>
>>
>>     this needs to be inside its own virtual host directive
>>
>>             DocumentRoot /home/civil/public_html/
>>             ServerName civil.farghnough.com <http://civil.farghnough.com>
>>             <Directory /home/civil/public_html/>
>>                 AllowOverride All
>>                 Options FollowSymLinks
>>                 Order allow,deny
>>                 Allow from All
>>             </Directory>
>>
> OK I had them in individual VirtualHost sections, but one of the sites I 
> googled showed them in a single section so I removed them.  Now it looks 
> like:
> 
> NameVirtualHost 1.2.3.4:80
> 
> <VirtualHost 1.2.3.4:80>
>     DocumentRoot /var/www/
>     ServerName farghnough.com
>     <Directory /var/www/>
>         AllowOverride All
>         Options FollowSymLinks
>         Order allow,deny
>         Allow from All
>     </Directory>
> </VirtualHost>
> 
> <VirtualHost 1.2.3.4:80>
>     DocumentRoot /home/civil/public_html/
>     ServerName civil.farghnough.com
>     <Directory /home/civil/public_html/>
>         AllowOverride All
>         Options FollowSymLinks
>         Order allow,deny
>         Allow from All
>     </Directory>
> </VirtualHost>
> 
> <VirtualHost 1.2.3.4:80>
>     DocumentRoot /home/curly-onions/public_html/
>     ServerName curly-onions.com
>     <Directory /home/curly-onions/public_html/>
>         AllowOverride All
>         Options FollowSymLinks
>         Order allow,deny
>         Allow from All
>     </Directory>
> </VirtualHost>
> 
> But still doesn't work.
> 
> Anything else pop to mind?  This is a system with a single ip address.
> 
> 
> Thanks,
> Jim.

	Those VirtualHost blocks look a lot like what I use although I tend to
also include a CustomLog for each virtual host to keep the logs
separate. If you include that what (if anything) do you see in the log
files?

	I've also made use of the vhost_alias module before as well and used
the following Virtual Host block:

NameVirtualHost *:80

<VirtualHost *:80>
        UseCanonicalName    Off
        VirtualDocumentRoot /srv/www/%0
        Options All

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

</VirtualHost>

	In this case I then create /srv/www/<hostname> and it's quite easy to
add another virtual host by simply making a directory (or link to an
existing directory) and then adding DNS records for it without having to
make any change to Apache.

	Regards,
	Jeremy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature




More information about the Ale mailing list