Virtual Hosts? Is that my problem?

Discussion in 'Apache' started by Adam65, Apr 27, 2008.

  1. #1
    HI Apache Guru's out there!

    I am pretty new to it all so forgive my dumb questions in advance.

    I have installed Apache2.2 on my Windows XP machine.
    I am able to open a browser, type localhost and get the index.html file out of the htdocs directory to pop up saying "It Works!"

    Great!
    Now when I add the Virtual Host directives into httpd-vhosts.conf (and uncomment the Include line under VirtualHosts in the httpd.conf file) I can't seem to get my other domain serving it's page to the browser!!

    I am soo frustrated...

    Here is my httpd.conf:

    ServerRoot "C:/webserver/www"
    Listen 80
    LoadModule actions_module modules/mod_actions.so
    LoadModule alias_module modules/mod_alias.so
    LoadModule asis_module modules/mod_asis.so
    LoadModule auth_basic_module modules/mod_auth_basic.so
    LoadModule authn_default_module modules/mod_authn_default.so
    LoadModule authn_file_module modules/mod_authn_file.so
    LoadModule authz_default_module modules/mod_authz_default.so
    LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
    LoadModule authz_host_module modules/mod_authz_host.so
    LoadModule authz_user_module modules/mod_authz_user.so
    LoadModule autoindex_module modules/mod_autoindex.so
    LoadModule cgi_module modules/mod_cgi.so
    LoadModule dir_module modules/mod_dir.so
    LoadModule env_module modules/mod_env.so
    LoadModule include_module modules/mod_include.so
    LoadModule isapi_module modules/mod_isapi.so
    LoadModule log_config_module modules/mod_log_config.so
    LoadModule mime_module modules/mod_mime.so
    LoadModule negotiation_module modules/mod_negotiation.so
    LoadModule setenvif_module modules/mod_setenvif.so
    <IfModule !mpm_netware_module>
    <IfModule !mpm_winnt_module>
    User daemon
    Group daemon
    </IfModule>
    </IfModule>
    ServerAdmin admin@hailpoker.com
    ServerName localhost:80
    DocumentRoot "C:/webserver/www/htdocs"
    <Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    </Directory>
    <Directory "C:/webserver/www/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
    <IfModule dir_module>
    DirectoryIndex index.html
    #haipoker.htm hailpoker.html index.htm
    </IfModule>
    <FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
    </FilesMatch>
    ErrorLog "logs/error.log"
    LogLevel warn
    <IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
    \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
    # You need to enable mod_logio.c to use %I and %O
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
    \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access.log" common
    #CustomLog "logs/access.log" combined
    </IfModule>
    <IfModule alias_module>
    ScriptAlias /cgi-bin/ "C:/webserver/www/cgi-bin/"
    </IfModule>
    <IfModule cgid_module>
    </IfModule>
    <Directory "C:/webserver/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
    </Directory>
    DefaultType text/plain
    <IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    #AddHandler cgi-script .cgi
    #AddHandler type-map var
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
    </IfModule>
    #MIMEMagicFile conf/magic
    #EnableMMAP off
    #EnableSendfile off

    # Virtual hosts
    #Include conf/extra/httpd-vhosts.conf
    NameVirtualHost 121.223.214.219:80

    <VirtualHost 121.223.214.219:80>
    ServerName www.hailpoker.com
    ServerAlias hailpoker.com *.hailpoker.com
    DocumentRoot c:/webserver/www/htdocs/
    DirectoryIndex hailpoker.html
    </VirtualHost>

    <VirtualHost 121.223.214.219:80>
    ServerName www.attackinfo.com.au
    ServerAlias attackinfo.com.au *.attackinfo.com.au
    DocumentRoot c:/webserver/www/htdocs/
    DirectoryIndex attackinfo.html
    </VirtualHost>


    <IfModule ssl_module>
    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin
    </IfModule>

    Okay.. the stuff in bold is exactly what shows in my httpd-vhosts.conf file.

    Firstly the only way I can get hailpoker.html to show in the browser is opening that file and saving it in the docroot directory (in my case: C:/webserver/www/htdocs) as index.html...then in place of the "It Works!" message when I enter in localhost or hailpoker.com i get my basic test page come up that I renamed from hailpoker to index.html. Great!... so now I know how to have my page come up when someone enters my domain name into a browser, you would think (haven't tested from a different internet connection). But what about this virtual host stuff... I cant seem to get it going.

    I get the same result if I comment out all of the virtual host directives so what Ive done so far is obviously ineffective. Can anyone help?

    Any questions or suggestions?
     
    Adam65, Apr 27, 2008 IP
  2. James.Blant

    James.Blant Active Member

    Messages:
    250
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    i'm note sure but write documentroot before serveralias and servername or place index files on separat folders
     
    James.Blant, Apr 27, 2008 IP