On Tue, 29 Mar 2005 15:25:13 -0800, Shabam <chalupa@yomama-nospam.com> wrote:
> Why won't this work? All I can get is the first virtual host to work.
From where, another PC on your LAN? How does browser resolve the virtual
host names (hosts file on client, or local DNS)? Of course you should not
really use test.com because that is a real domain.
If you actually wanted to access these virtual hosts from internet with
names that resolve to your public IP and server on private behind NAT
router, you would likely need to use wildcard NameVirtualHost * and
<VirtualHost *> sections.
> NameVirtualHost 192.168.0.3
It may be best to put UseCanonicalName Off here in main section, to make
sure that automatic redirects would go to requested virtual host instead
of default (first) vhost.
> ###################################### IMG.COM.test.com
> ##############################
>
><VirtualHost 192.168.0.3>
>
> ServerName img.com.test.com
> ServerAdmin webmaster@test.com
> DocumentRoot /www/whatever/htdocs/com
> CustomLog /www/whatever/logs/access_log combined
Where do you define LogFormat for "combined"? You might instead try:
CustomLog /www/whatever/logs/access_log "%V %h %l %u %t \"%r\" %>s %b"
And see what requested virtual host shows up in first slot (%V)
> ErrorLog /www/whatever/logs/error_log
>
> UseCanonicalName Off
>
><Directory /www/whatever/htdocs/com>
> Options Indexes
> DirectoryIndex index.html index.htm Index.htm Index.html INDEX.HTM
> INDEX.HTML
>
>
></Directory>
>
></VirtualHost>
>
> ################################################## ##########################
> ##########
>
>
> ###################################### IMG.test.com
> ##################################
>
><VirtualHost 192.168.0.3>
>
> ServerName img.test.com
> ServerAdmin webmaster@test.com
> DocumentRoot /www/whatever/htdocs
> CustomLog /www/whatever/logs/access_log combined
> ErrorLog /www/whatever/logs/error_log
>
> UseCanonicalName Off
>
><Directory /www/whatever/htdocs>
> Options Indexes
> DirectoryIndex index.html index.htm Index.htm Index.html INDEX.HTM
> INDEX.HTML
>
></Directory>
>
></VirtualHost>