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 am trying to access my server as

http://somedomain.com http://anotherdomain.com http://serverip

With NameVirutalHost configuration, the domain names are redirected to their respective folders. But for serverip, I want apache to serve me a different folder. But it is serving me the content for anotherdomain.com. My system is Ubuntu 11.04. How can this issue be solved ?

share|improve this question
    
Can we get output the virtualhost section of both sites? –  Rilindo Jul 26 '11 at 17:27
    
You mean you want the exact configuration options ? –  sul4bh Jul 26 '11 at 17:41
add comment

1 Answer

up vote 1 down vote accepted

Try defining a NameVirtualHost for serverip as you would for any other name. It should also be the first one you define (this will make it the default virtual host if no HTTP Host: header is received, as often happens when you point a web browser at an IP address).

share|improve this answer
    
I already tried that. I checked that the browsers send IP address in HOST field and used the IP address for ServerName. But that does not seem to work. –  sul4bh Jul 26 '11 at 17:39
    
I added ServerName <serverip> in a VirtualHost directive and it seems to work fine now. Thanks for you suggestion. –  sul4bh Jul 26 '11 at 18:00
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.