Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We recently moved from name-based hosting to individual IPs for an SSL implementation. Thus, each website now has its own IP. While and are being directed to the correct directories on the server, subdomains such as and are not. The subdomains also have their own IPs. Here's the structure of one of the subdomain's .conf files:

    DocumentRoot /var/www/domain1-dev
    ErrorLog logs/
    CustomLog logs/ common

    <Directory /var/www/domain1-dev>
      Options Indexes FollowSymLinks
      AllowOverride All
      Order allow,deny
      Allow from all

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.

Thanks much.


Here's what I get when running /usr/sbin/httpd -S:

# /usr/sbin/httpd -S
httpd: apr_sockaddr_info_get() failed for
httpd: Could not reliably determine the server's fully qualified domain name, using for ServerName
VirtualHost configuration: (/etc/httpd/conf.d/domain2.conf:10) (/etc/httpd/conf.d/ssl.conf:87) (/etc/httpd/conf.d/domain1.conf:1) (/etc/httpd/conf.d/ssl.conf:45) (/etc/httpd/conf.d/domain1-dev.conf:1)
Syntax OK


Here's the syntax for each domain:

    DocumentRoot /var/www/html
    ErrorLog logs/
    CustomLog logs/ common
share|improve this question
Are you sure that dns for and point to – becomingwisest Feb 2 '11 at 22:50
Yes, points to Good check. We're not currently using, but will in the future. – MattB Feb 3 '11 at 17:19
up vote 1 down vote accepted

I don't see any issue with the VirtualHost config here, but it's pretty possible that even with that apache will choose the wrong one, just to give you some insight to help fix your issue

  • apache will always read the VirtualHosts in order
  • It'll choose which one accomodates better yours needs based on that
  • If you have any ServerAlias *.domain anything assigned to your domain after that is dead, always put the glob aliases at the end

Hope this helps you a bit!

share|improve this answer
Thanks. Here's the line in httpd.conf that reads the individual .conf files: "Include conf.d/*.conf". The individual .conf files are listed in the correct order I believe, with domain1-dev coming after domain1 in the alphabetical file order. Would you have any suggestions on how to check how Apache is reading these .conf files once loaded? I'm unsure why the ServerAlias is there. Old admin must have thought it important. I'll move it to the end of the subdomain conf file. – MattB Feb 2 '11 at 17:50
Yes! In order to get it right, just rename the one having the catchall ServerAlias to zzz_whatever.conf, it'll read the files in alphabetical order so you have some leeway there – lynxman Feb 2 '11 at 17:54
Added an example of the domain .conf file. Should there only be one ServerAlias and it resides in the last .conf file? Right now each .conf has it's own ServerAlias. – MattB Feb 2 '11 at 18:58
Nope, it's just a question of ordering, as you see the last config is the dev file so the other ones take precedence – lynxman Feb 2 '11 at 23:13
Looks like it worked! Thanks a ton. I ended up renaming domain1-dev.conf to dev-domain1.conf. The solution was so simple and I was making it more complex than needed. – MattB Feb 4 '11 at 13:01


$PATH_TO_APACHE_DIR/bin/httpd -S

to see what VirtualHosts are recognized and in what files might help. Run "httpd -h" to see a list of other options to show settings.

share|improve this answer
Added httpd -S output to my question. Thanks. Based on what I'm seeing, it should be working, unless domain1-dev.conf should be listed first. :-/ – MattB Feb 2 '11 at 18:51

For work name-based hosts on more than one IP address, use

NameVirtualHost IP:80

in your output httpd -S no "NameVirtualHosts".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.