Hi!
I'm having some problems to configure the httpd.conf with multiple domains and subdomains on one IP.
I'm able to run a single domain with its subdomains, but multiple domains with multiple subdomains always returns me the 1st website of the config file.
I've read the doc, but it always concern multiple hosts or subdomains, not the mixed case.
So, i'd like to run 2 internet domains (with their respectives subdomains):
- xxx.domain1.com (alias: domain1.com)
- sub1.domain1.com
- sub2.domain1.com
(no separated logs, everything logged under domain1.com)
and
- xxx.domain2.com (alias: domain2.com)
- foo.domain2.com
- bar.domain2.com
(no separated logs, everything logged under domain2.com)
and the primary will be a local domain:
- home
(own access and error logs)
Code:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName xxx.domain1.com
ServerAlias domain1.com
DocumentRoot /home/htdocs/domain1.com/
CustomLog /home/htdocs/domain1.com/logs/domain1.com_access.log combined
ErrorLog /home/htdocs/domain1.com/logs/domain1.com_error.log
</VirtualHost>
<VirtualHost *:80>
ServerName sub1.domain1.com
DocumentRoot /home/htdocs/domain1.com/sub1/
</VirtualHost>
<VirtualHost *:80>
ServerName sub2.domain1.com
DocumentRoot /home/htdocs/domain1.com/sub2/
</VirtualHost>
<VirtualHost *:80>
ServerName xxx.domain2.com
ServerAlias domain2.com
DocumentRoot /home/htdocs/domain2.com/
CustomLog /home/htdocs/domain2.com/logs/domain2.com_access.log combined
ErrorLog /home/htdocs/domain2.com/logs/domain2.com_error.log
</VirtualHost>
<VirtualHost *:80>
ServerName foo.domain2.com
DocumentRoot /home/htdocs/domain2.com/foo/
</VirtualHost>
<VirtualHost *:80>
ServerName bar.domain2.com
DocumentRoot /home/htdocs/domain2.com/bar/
</VirtualHost>
and for the local site:
Code:
Port 80
ServerName home
ServerAdmin contact@home
DocumentRoot /home/htdocs/home
So when I try to reach xxx.domain2.com it always displays me xxx.domain1.com
UseCanonicalName and HostnameLookups are Off
any ideas?
thanks!
chrisfx
PS: as I'm new here and cannot post URLs containing "www" yet, i replaced "www" to "xxx" but it doesn't matter, just an ethetic point :P