What is wrong here?
NameVirtualHost *:80
<VirtualHost *:80>
ServerName domain1.com
ServerAdmin membersupport@domain1.com
DocumentRoot /var/www/html/domain1-com
</VirtualHost>
<VirtualHost *:80>
ServerName domain2.com
ServerAlias www.domain2.com
ServerAdmin hello@domain2.com
DocumentRoot /var/www/html/domain2-com
</VirtualHost>
Problem:
domain1.com
correctly serves the content at /var/www/html/domain1-com
, but domain2.com
also serves the content at /var/www/html/domain1-com
.
Here is the output of httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server domain1.com (/etc/httpd/conf/extra/httpd-vhosts.conf:21)
port 80 namevhost domain1.com (/etc/httpd/conf/extra/httpd-vhosts.conf:21)
port 80 namevhost domain2.com (/etc/httpd/conf/extra/httpd-vhosts.conf:27)
Syntax OK
This is apache version 2.2.22.
Thanks in advance.
UPDATED - Based on the answers below, I updated my conf file and the question. Unforunately the problem still exists. (I had only added _default_
as part as my attempt to resolve the issue myself prior to asking the question.)