Apache Virtual Hosts

Discussion in 'Site & Server Administration' started by Gompho, Sep 30, 2008.

  1. #1
    So after may days and reading many articles and forums I've decided to start a new thread.

    With my current configuration I can't get virtual hosts to work. When I type in either domain name it takes me to the same web page not the documents I'm trying to server.The http headers are coming through and I can see either domain being called but no matter what I do I still get the same first page I'm serving. I'll explain further.

    Heres my httpd.conf

    <VirtualHost *>
    # Basic setup
    ServerAdmin webmaster@foo.com
    ServerName foo.com
    ServerAlias www.foo.com

    DocumentRoot /var/vwww/foo.com/html

    # HTML documents, with indexing.
    <Directory />
    Options +Includes
    </Directory>

    # CGI Handling
    ScriptAlias /cgi-bin/ /var/vwww/foo.com/cgi-bin
    <Location /cgi-bin>
    Options +ExecCGI
    </Location>

    # Logfiles
    ErrorLog /var/vwww/foo.com/logs/error_log
    CustomLog /var/vwww/foo.com/logs/access_log combined
    </VirtualHost>

    <VirtualHost *>
    # Basic setup
    ServerAdmin webmaster@bar.com
    ServerName bar.com
    ServerAlias www.bar.com
    DocumentRoot /var/www/html


    # HTML documents, with indexing.
    <Directory />
    Options +Includes
    </Directory>

    # CGI Handling
    ScriptAlias /cgi-bin/ /var/www/cgi-bin
    <Location /cgi-bin>
    Options +ExecCGI
    </Location>

    # Logfiles
    ErrorLog /var/www/logs/error_log
    CustomLog /var/www/logs/access_log combined
    </VirtualHost>

    now heres my access_log:

    for foo.com
    192.18.101.5 - - [30/Sep/2008:21:54:11 -0300] "GET /sites/default/files/color/pixture-3dd4b9b9/block-br.png HTTP/1.1" 200 149 "http://foo.com/sites/default/files/color/pixture-3dd4b9b9/style.css?i" "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.3) Gecko/20070321 Firefox/2.0.0.3"

    for bar.com
    192.18.101.5 - - [30/Sep/2008:22:34:36 -0300] "GET /sites/default/files/color/pixture-3dd4b9b9/block-bl.png HTTP/1.1" 200 154 "http://bar.com/sites/default/files/color/pixture-3dd4b9b9/style.css?i" "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.3) Gecko/20070321 Firefox/2.0.0.3"

    interestingly enough these are from the default /var/log/httpd/access_log not from where I told it to be logged in httpd.conf

    and heres confirming that the same ip is being called for each domain

    # nslookup foo.com
    Server: 192.168.2.100
    Address: 192.168.2.100#53

    Name: foo.com
    Address: 24.89.217.65

    # nslookup bar.com
    Server: 192.168.2.100
    Address: 192.168.2.100#53

    Name: bar.com
    Address: 24.89.217.65

    both are defined in my dns server with an A Name pointing to the correct ip.

    Well thats about it does any one else have any ideas or any suggestions about how I could achieve the same affect as apache virtual servers through some other means.

    Thanks
     
    Gompho, Sep 30, 2008 IP