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

Pinging both www.example.com and example.com show that my ip address is correct

<VirtualHost *:80>
        ServerAdmin example@gmail.com
        ServerName example.com
        ServerAlias www.example.com example.com
        DocumentRoot /var/www/example.com/public
        SetEnv APPLICATION_ENV live
</VirtualHost>

Accessing www.example.com works fine, however when I access example.com I see the default it works message (which is storred in /var/www/index.html)

Pinging both www.example.com and example.com show that my ip address is correct, what other steps can I do to figure out the root of the problem?

share|improve this question
    
You have example.com already in the ServerName. You don't need it in the ServerAlias too. –  Raffael Luthiger May 14 '11 at 11:19
    
Cool, I just added that extra alias under frustration, didn't work without it –  Moak May 14 '11 at 11:53

1 Answer 1

Try separating your ServerName's.

<VirtualHost *:80>
        ServerAdmin example@gmail.com
        ServerName example.com
        ServerAlias www.example.com
        ServerAlias example.com
        DocumentRoot /var/www/example.com/public
        SetEnv APPLICATION_ENV live
</VirtualHost>

(Although as the first comment says, you shouldn't need to have a serveralias for example.com as it's your server-name)

Are there any other VHosts? What's the default server-name in httpd.conf (If it was example.com, that would override the vhost, I think)

share|improve this answer
    
+1, I second that there's probably other vhosts loading first and taking the name. –  Shane Madden May 14 '11 at 19:37

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.