We recently moved from name-based hosting to individual IPs for an SSL implementation. Thus, each website now has its own IP. While www.domain1.com and www.domain2.com are being directed to the correct directories on the server, subdomains such as dev.domain1.com and dev.domain2.com are not. The subdomains also have their own IPs. Here's the structure of one of the subdomain's .conf files:
<VirtualHost 126.96.36.199:80> ServerAdmin email@example.com DocumentRoot /var/www/domain1-dev ServerName dev.domain1.com ServerAlias dev.domain2.com ErrorLog logs/dev.domain1.com-error.log CustomLog logs/dev.domain1.com-access.log common <Directory /var/www/domain1-dev> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
ServerName is currently commented out and UseCanonicalName is set to be off in the main httpd.conf file. DocumentRoot is set to domain1's path in this httpd.conf file, as is the directive. NameVirtualHost is commented out as we're now on ip-based hosting.
Any idea what could be wrong? :-( It's almost as if subdomain .conf files aren't being read, or else the main domain's settings are being used instead. In fact, any subdomain I type is showing the primary domain's website, even if its not defined under a .conf file.
Here's what I get when running /usr/sbin/httpd -S:
# /usr/sbin/httpd -S httpd: apr_sockaddr_info_get() failed for the.servername.com httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName VirtualHost configuration: 188.8.131.52:80 www.domain2.com (/etc/httpd/conf.d/domain2.conf:10) 184.108.40.206:443 www.domain2.com (/etc/httpd/conf.d/ssl.conf:87) 220.127.116.11:80 www.domain1.com (/etc/httpd/conf.d/domain1.conf:1) 18.104.22.168:443 www.domain1.com (/etc/httpd/conf.d/ssl.conf:45) 22.214.171.124:80 dev.domain1.com (/etc/httpd/conf.d/domain1-dev.conf:1) Syntax OK
Here's the syntax for each domain:
<VirtualHost 126.96.36.199:80> ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/html ServerName www.domain1.com ServerAlias domain1.com ErrorLog logs/www.domain1.com-error.log CustomLog logs/www..domain1.com-access.log common </VirtualHost>