Re: VirtualHost and default domain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting "Frank M. Ramaekers" <FRamaekers@xxxxxxxxxx>:

I have successfully setup three virtual hosts.

<VirtualHost *>
  ServerName abc.domain.com
  ServerAlias def.domain.com
  DocumentRoot /var/www/html
   :
</VirtualHost>

<VirtualHost *>
  ServerName xyz.domain.com
  DocumentRoot /home/www/xyz
   :
</VirtualHost>


This seems to work fine except when only the xyz host name is type (i.e.
without the domain name entered)

abc			->	/var/www/html
abc.domain.com	->	/var/www/html
def			->	/var/www/html
xyz			->	/var/www/html *WRONG*
xyz.domain.com	->	/home/www/xyz

Is there anything that can be configured in Apache to handle this?  I
want to enter the host name only (abc, def or xyz) and receive the
correct site.

The default virtual host is the first one (the one with DocumentRoot /var/www/html in your case). When you access http://xyz, you are accessing a site which is not matched by any virtual host, therefore Apache shows the default virtual host. Adding a "ServerAlias xyz" below "ServerName xyz.domain.com" should fix it.

--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux