Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two domains, mycommunitysite.com and mypersonalblog.com

When I go to mypersonalblog.com, everything works. When I go to mycommunitysite.com, it also goes to the mypersonalblog.com front page. If I go to mycommunitysite.com/forum, it goes to the forum subdirectory of mycommunitysite.com as expected.

The virtual host directives in apache look like this, my server is running CentOS, if that makes a difference:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin me@gmail.com
    DocumentRoot /var/www/mycommunitysite
    ServerName mycommunitysite.com
    ServerAlias www.mycommunitysite.com
    ErrorLog logs/mycommunitysite.com
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin me@gmail.com
    DocumentRoot /var/www/mypersonalblog
    ServerName mypersonalblog.com
    ServerAlias www.mypersonalblog.com
    ErrorLog logs/mypersonalblog.com
</VirtualHost>

The output of apachectl -S

httpd: Could not reliably determine the server's fully qualified domain name, using 108.166.78.198 for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server myweddingsite.com (/etc/httpd/conf/httpd.conf:1015)
         port 80 namevhost myweddingsite.com (/etc/httpd/conf/httpd.conf:1015)
         port 80 namevhost clientsite.com (/etc/httpd/conf/httpd.conf:1025)
         port 80 namevhost mycommunitysite.com (/etc/httpd/conf/httpd.conf:1035)
         port 80 namevhost mypersonalblog.com (/etc/httpd/conf/httpd.conf:1053)
Syntax OK
share|improve this question
1  
Do you have both the default and a virtual host for "myweddingsite.com"?? –  Chris S Sep 19 '12 at 14:04
add comment

2 Answers

Add a global directive ServerName www.example.com to httpd.conf
Be sure you're DNS has forward and reverse looking working correctly for all domain names and IPs.

share|improve this answer
    
I added the ServerName directive, which has stopped the complaining about FQDN on apache, but my problem still persists. How do I know if Forward and Reverse Lookup is working correctly> –  DVG Sep 19 '12 at 15:06
    
dig forward.name.example.com and dig -x 12.34.56.78. If you can not get DNS configured correctly for whatever reason, adding the relevant entries to the servers /etc/hosts file will cheat the server into thinking that you have DNS configured. –  Chris S Sep 19 '12 at 17:44
add comment

If /etc/hosts is missing an entry for the IP that Apache is trying to bind to, it will complain about not being able to determine the FQDN. This seems to affect VirtualHosts.

share|improve this answer
add comment

Your Answer

 
discard

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.