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'm setting up a virtual host on a linux machine.

I've already made necessary DNS changes and they have propagated and are working correctly.

There are many other virtual hosts setup in my /etc/httpd/conf/httpd.conf file that are working correctly (someone else set all these up). My config for the new virtual host is this (where the real IP has been replaced with ##.###.###.###):

<VirtualHost ##.###.###.###:80>
    ServerName www.website.com
    ServerAlias website.com
    DocumentRoot /var/www/html/website.com
    ErrorLog logs/website.com-error_log
    CustomLog logs/website.com-access_log combined
</VirtualHost>
<Directory /var/www/html/website.com>
    Order deny,allow
    Allow from all
    AllowOverride All
</Directory>

All the files for the site are sitting in /var/www/html/website.com. When I visit website.com, the main site on this server is displayed rather than website.com.

What are some other configuration settings (anywhere) that could be doing this? There are other virtual hosts set up in an identical manner (from what I can tell) and they are working correctly.

share|improve this question

migrated from stackoverflow.com Jul 30 '11 at 10:49

This question came from our site for professional and enthusiast programmers.

    
Did you enable it? Also, is this stored on your local machine? –  ngen Jul 30 '11 at 9:14
    
I'm not sure what enabling it means? The files are local to the machine running apache. –  T. Brian Jones Jul 30 '11 at 9:17
    
Note that you should add the Directory section inside the virtualhost section, not after, as here it means this directory is available for all virtualhosts (global scope) –  regilero Jul 30 '11 at 12:58

1 Answer 1

up vote 3 down vote accepted

Do you have such lines for you ip?

# Listen for virtual host requests on IP addresses
NameVirtualHost ##.###.#.###:80

or

NameVirtualHost *

http://httpd.apache.org/docs/2.0/vhosts/examples.html

Note

You can, if you wish, replace * with the actual IP address of the system. In that case, the argument to VirtualHost must match the argument to NameVirtualHost

share|improve this answer
    
Yes. That line IS present in the httpd.conf file. –  T. Brian Jones Jul 30 '11 at 9:19
    
Is the NameVirtualHost argument exactly the same? Can you check access log of default site to find the "Host" parameter in it? Do you have a Listen ##.###.#.###:80? –  osgx Jul 30 '11 at 9:22
2  
And did you a restart of apache before testing? –  osgx Jul 30 '11 at 9:23
    
embarrassed... no i did not restart apache. this should do it. this is someone else's server though, and i don't have sudo privileges to restart it. guess i'll send an email and wait. –  T. Brian Jones Jul 30 '11 at 9:40

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.