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
<Directory /var/www/html/website.com>
    Order deny,allow
    Allow from all
    AllowOverride All

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.

  • 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

Do you have such lines for you ip?

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


NameVirtualHost *



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

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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