You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Frank M. Ramaekers" <FR...@ailife.com> on 2008/01/09 21:25:42 UTC
[users@httpd] VirtualHost and default domain
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.
TIA,
Frank M. Ramaekers Jr.
Systems Programmer MCP, MCP+I, MCSE & RHCE
American Income Life Insurance Co. Phone: (254)761-6649
1200 Wooded Acres Dr. Fax: (254)741-5777
Waco, Texas 76701
_____________________________________________________
This message contains information which is privileged and confidential and is solely for the use of the
intended recipient. If you are not the intended recipient, be aware that any review, disclosure,
copying, distribution, or use of the contents of this message is strictly prohibited. If you have
received this in error, please destroy it immediately and notify us at PrivacyAct@ailife.com.
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] VirtualHost and default domain
Posted by Pau Garcia i Quiles <pg...@elpauer.org>.
Quoting Gregor Schneider <rc...@googlemail.com>:
You can have more than one ServerName (provided they are in different
VirtualHost directives):
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
> If I'm not mistaken, you should use only ONE overall
> ServerName-directive in your configs, the rest should be handled with
> ServerAlias (even having multiple VHosts)
>
> Meaning, if you change
>
> ServerName xyz.domain.com
>
> to
>
> ServerAlias xyz.domain.com
>
> it should work.
>
> Cheers
>
> Gregor
> --
> what's puzzlin' you, is the nature of my game
> gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
> gpgp-key available @ http://pgpkeys.pca.dfn.de:11371
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
--
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] VirtualHost and default domain
Posted by Gregor Schneider <rc...@googlemail.com>.
If I'm not mistaken, you should use only ONE overall
ServerName-directive in your configs, the rest should be handled with
ServerAlias (even having multiple VHosts)
Meaning, if you change
ServerName xyz.domain.com
to
ServerAlias xyz.domain.com
it should work.
Cheers
Gregor
--
what's puzzlin' you, is the nature of my game
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available @ http://pgpkeys.pca.dfn.de:11371
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: [users@httpd] VirtualHost and default domain
Posted by "Frank M. Ramaekers" <FR...@ailife.com>.
Thanks that did the trick...oh I forgot one other possibility:
abc.domain.com/xyz -> /home/www/xyz
(perhaps a rewrite to xyz.domain.com as well)
Frank M. Ramaekers Jr.
Systems Programmer MCP, MCP+I, MCSE & RHCE
American Income Life Insurance Co. Phone: (254)761-6649
1200 Wooded Acres Dr. Fax: (254)741-5777
Waco, Texas 76701
-----Original Message-----
From: Pau Garcia i Quiles [mailto:pgquiles@elpauer.org]
Sent: Wednesday, January 09, 2008 2:57 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] VirtualHost and default domain
Quoting "Frank M. Ramaekers" <FR...@ailife.com>:
> 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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
_____________________________________________________
This message contains information which is privileged and confidential and is solely for the use of the
intended recipient. If you are not the intended recipient, be aware that any review, disclosure,
copying, distribution, or use of the contents of this message is strictly prohibited. If you have
received this in error, please destroy it immediately and notify us at PrivacyAct@ailife.com.
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] VirtualHost and default domain
Posted by Pau Garcia i Quiles <pg...@elpauer.org>.
Quoting "Frank M. Ramaekers" <FR...@ailife.com>:
> 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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org