Find the answer to your Linux question:
Results 1 to 3 of 3
Hi I've been beeting my head for the last 4 days trying to figure out what's wrong. I've read 3 different books and literally viewed hundereds of forum posts but ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2006
    Posts
    2

    Apache2 virtual host not working


    Hi I've been beeting my head for the last 4 days trying to figure out what's wrong. I've read 3 different books and literally viewed hundereds of forum posts but to no avail.

    My problem is that I am attempting to setup name based virtual hosts and the server only ever returns the default website. Here is what I have in my /etc/apache2/httpd.conf, by the way I'm running Suse 10.

    ameVirtualHost *

    <VirtualHost *>
    ServerName www.website1
    DocumentRoot /srv/www/directory1/
    UseCanonicalName off

    <Directory "/srv/www/directory1">
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    <VirtualHost *>
    ServerName website2.com
    ServerAlias www.website2.com
    DocumentRoot /srv/www/directory2/
    UseCanonicalName off

    <Directory /srv/www/directory2">
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    <VirtualHost *>
    ServerName www.website3.ca
    DocumentRoot /srv/www/directory3/
    UseCanonicalName off

    <Directory "/srv/www/website3">
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    Any ideas would be great. Thanks

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,847
    Hmmm - my virtual hosts have the <Directory...> sections outside of the <VirtualHost...> block. Maybe you could try that?

    Other things to check...

    - that your dns server is at least giving a response for an IP address for the name you're using. If it's not, then the browser cant even contact your server by name, let alone ask for any pages. Usually this amounts to putting CNAME entries in the DNS for the virtual hostnames.

    - that the directories you're specifying as the source for the virtual host is readable by apache. Normally you should make sure the group is set to 'apache' or 'httpd' (depending on what your apache server runs as) and make sure the directories have unix permissions of 'g+rx'.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Just Joined!
    Join Date
    Sep 2006
    Posts
    2
    Thanks for your ideas. I think that you are right with the cname issue. I have noticed that when I typed my website into a browser I would get the ip address shoiwing in the address bar after the page was loaded. I will adjust the CName entries and let you know.


    Thanks again

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •