I am having a problem with subdomains, alias & virtual hosts Centos 4.3, Apache 2.0.52 & PHP 5.04 I can get the primary to work, but not the aliased servers. http.conf extract ********* NameVirtualHost * <VirtualHost *> ServerName www.domain.com DocumentRoot /var/www/html/domain/ ServerAlias www.altdomain.com http://www.altdomain.com </VirtualHost>
<VirtualHost *> ServerName subdomain.domain.com DocumentRoot /var/www/html/subdomain/ ServerAlias www.subdomain.altdomain.com http://www.subdomain.altdomain.com </VirtualHost> **********
dave
On Fri, 2006-06-09 at 15:41 -0600, Dave J. Hornford wrote:
I am having a problem with subdomains, alias & virtual hosts Centos 4.3, Apache 2.0.52 & PHP 5.04 I can get the primary to work, but not the aliased servers. http.conf extract
NameVirtualHost * <VirtualHost *> ServerName www.domain.com DocumentRoot /var/www/html/domain/ ServerAlias www.altdomain.com
</VirtualHost>
<VirtualHost *> ServerName subdomain.domain.com DocumentRoot /var/www/html/subdomain/ ServerAlias www.subdomain.altdomain.com
</VirtualHost> **********
The name as used in the browser URL must match exactly what you specify as the ServerName or a ServerAlias (you can have more than one name there). Are you sure everything is spelled exactly right and you didn't omit the domain name in the browser? The first one in the list is used if nothing matches.
-- Les Mikesell lesmikesell@gmail.com
-----Original Message----- From: Les Mikesell [mailto:lesmikesell@gmail.com] Sent: June 9, 2006 4:01 PM To: CentOS mailing list Subject: Re: [CentOS] Virtualhost, Alias & Subdomains
On Fri, 2006-06-09 at 15:41 -0600, Dave J. Hornford wrote:
I am having a problem with subdomains, alias & virtual hosts Centos 4.3, Apache 2.0.52 & PHP 5.04 I can get the primary to work, but not the aliased servers. http.conf extract
NameVirtualHost * <VirtualHost *> ServerName www.domain.com DocumentRoot /var/www/html/domain/ ServerAlias www.altdomain.com
</VirtualHost>
<VirtualHost *> ServerName subdomain.domain.com DocumentRoot /var/www/html/subdomain/ ServerAlias www.subdomain.altdomain.com </VirtualHost>
The name as used in the browser URL must match exactly what you specify as the ServerName or a ServerAlias (you can have more than one name there). Are you sure everything is spelled exactly right and you didn't omit the domain name in the browser? The first one in the list is used if nothing matches.
-- Les,
Thanks. In my testing I'm copying & pasting. I am getting the first in the list. You mention more than one.
Could I skip the alias part and enter: ServerName www.subdomain.domain.com subdomain.domain.com subdomain.altdomain.com www.subdomain.altdomain.com
Dave
Could I skip the alias part and enter: ServerName www.subdomain.domain.com subdomain.domain.com subdomain.altdomain.com www.subdomain.altdomain.com
No. You get one ServerName directive, but you can have multiple ServerAlias entries. See http://httpd.apache.org/docs/2.0/vhosts/name-based.html and http://httpd.apache.org/docs/2.0/mod/core.html#serveralias
On Fri, 2006-06-09 at 16:12 -0600, Dave Hornford wrote:
The name as used in the browser URL must match exactly what you specify as the ServerName or a ServerAlias (you can have more than one name there). Are you sure everything is spelled exactly right and you didn't omit the domain name in the browser? The first one in the list is used if nothing matches.
s,
Thanks. In my testing I'm copying & pasting. I am getting the first in the list. You mention more than one.
Could I skip the alias part and enter: ServerName www.subdomain.domain.com subdomain.domain.com subdomain.altdomain.com www.subdomain.altdomain.com
No, ServerName may also be used in redirects so it is a special case. Do you have DNS working so all the names resolve to the same IP? For testing you can use the hosts file on the machine running the browser to get the same effect.
-----Original Message----- From: Les Mikesell [mailto:lesmikesell@gmail.com] Sent: June 9, 2006 4:29 PM To: CentOS mailing list Subject: RE: [CentOS] Virtualhost, Alias & Subdomains
On Fri, 2006-06-09 at 16:12 -0600, Dave Hornford wrote:
The name as used in the browser URL must match exactly what you specify as the ServerName or a ServerAlias (you can have more than one
name there).
Are you sure everything is spelled exactly right and you didn't omit the domain name in the browser? The first one in the list is used if nothing matches.
s,
Thanks. In my testing I'm copying & pasting. I am getting the first in the list. You mention more than one.
Could I skip the alias part and enter: ServerName www.subdomain.domain.com subdomain.domain.com subdomain.altdomain.com www.subdomain.altdomain.com
No, ServerName may also be used in redirects so it is a special case. Do you have DNS working so all the names resolve to the same IP? For testing you can use the hosts file on the machine running the browser to get the same effect.
-- Les, Thanks. It seemed to easy. It looks like I may have a dns propagation problem. I am directed to the server and server is being directed to the old host.
Dave
On Fri, 2006-06-09 at 16:32 -0600, Dave Hornford wrote:
The name as used in the browser URL must match exactly what you specify as the ServerName or a ServerAlias (you can have more than one
name there).
Are you sure everything is spelled exactly right and you didn't omit the domain name in the browser? The first one in the list is used if nothing matches.
s,
Thanks. In my testing I'm copying & pasting. I am getting the first in the list. You mention more than one.
Could I skip the alias part and enter: ServerName www.subdomain.domain.com subdomain.domain.com subdomain.altdomain.com www.subdomain.altdomain.com
No, ServerName may also be used in redirects so it is a special case. Do you have DNS working so all the names resolve to the same IP? For testing you can use the hosts file on the machine running the browser to get the same effect.
-- Les, Thanks. It seemed to easy. It looks like I may have a dns propagation problem. I am directed to the server and server is being directed to the old host.
If you enter a name which is actually a directory but omit the trailing /, the server will redirect you with the new URL containing the trailing / so subsequent relative links will work. If you have UseCanonicalName on, it will use the name specified as ServerName for the redirect even if your inital URL used an alias or IP. Regardless, all DNS lookups should be done at the browser client side.
-----Original Message----- From: Les Mikesell [mailto:lesmikesell@gmail.com] Sent: June 9, 2006 4:56 PM To: CentOS mailing list Subject: RE: [CentOS] Virtualhost, Alias & Subdomains
On Fri, 2006-06-09 at 16:32 -0600, Dave Hornford wrote:
The name as used in the browser URL must match exactly what you specify as the ServerName or a ServerAlias (you can have more than one
name there).
Are you sure everything is spelled exactly right and you didn't omit the domain name in the browser? The first one in the list is used if nothing matches.
s,
Thanks. In my testing I'm copying & pasting. I am getting the first in the list. You mention more than one.
Could I skip the alias part and enter: ServerName www.subdomain.domain.com subdomain.domain.com subdomain.altdomain.com www.subdomain.altdomain.com
No, ServerName may also be used in redirects so it is a special case. Do you have DNS working so all the names resolve to the same IP? For testing you can use the hosts file on the machine running the browser to get the same effect.
-- Les, Thanks. It seemed to easy. It looks like I may have a dns propagation problem. I am directed to the server and server is being directed to the old host.
If you enter a name which is actually a directory but omit the trailing /, the server will redirect you with the new URL containing the trailing / so subsequent relative links will work. If you have UseCanonicalName on, it will use the name specified as ServerName for the redirect even if your inital URL used an alias or IP. Regardless, all DNS lookups should be done at the browser client side.
-- Les, Thanks. I changed <VirtualHost *> to <VirtualHost *:80> and it now works. Dave
Dave Hornford wrote:
Thanks. I changed <VirtualHost *> to <VirtualHost *:80> and it now works. Dave
Dave:
FYI I've found it can take as many as 3 days to get DNS updates propagated, although usually it happens within 24 hours. I've been bitten by that before, thought I had done something wrong when I just hadn't waited long enough.
Glad you got everything working.
-Ben
Dave J. Hornford wrote:
I am having a problem with subdomains, alias & virtual hosts Centos 4.3, Apache 2.0.52 & PHP 5.04 I can get the primary to work, but not the aliased servers. http.conf extract
NameVirtualHost * <VirtualHost *> ServerName www.domain.com http://www.domain.com DocumentRoot /var/www/html/domain/ ServerAlias www.altdomain.com http://www.altdomain.com
</VirtualHost>
<VirtualHost *> ServerName subdomain.domain.com DocumentRoot /var/www/html/subdomain/ ServerAlias www.subdomain.altdomain.com http://www.subdomain.altdomain.com
</VirtualHost> **********
Are you trying to access the alias on the local machine or a remote machine?
Does DNS reflect the correct information, or need to be updated to reflect the alias(es)?
-----Original Message----- From: Ben Gore [mailto:ben@cleocat.com] Sent: June 9, 2006 4:10 PM To: CentOS mailing list Subject: Re: [CentOS] Virtualhost, Alias & Subdomains
Dave J. Hornford wrote:
I am having a problem with subdomains, alias & virtual hosts Centos 4.3, Apache 2.0.52 & PHP 5.04 I can get the primary to work, but not the aliased servers. http.conf extract
NameVirtualHost * <VirtualHost *> ServerName www.domain.com http://www.domain.com DocumentRoot /var/www/html/domain/ ServerAlias www.altdomain.com http://www.altdomain.com </VirtualHost>
<VirtualHost *> ServerName subdomain.domain.com DocumentRoot /var/www/html/subdomain/ ServerAlias www.subdomain.altdomain.com http://www.subdomain.altdomain.com
</VirtualHost> **********
Are you trying to access the alias on the local machine or a remote machine?
Does DNS reflect the correct information, or need to be updated to reflect the alias(es)?
********** Ben, Remote machine. Single IP right now. I have a dns entry for domain, altdomain, sub.domain & sub.altdomain. (I don't control the nameserver, and had the entries put in this am) I just checked and from where I am the new server IP is coming up. From the server the old IP is coming up.
Dave
_______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos