logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: VHost Issues(Only Uses First One)
Author
KuraKai



Joined: 09 Nov 2007
Posts: 12

PostPosted: Wed 12 Dec '07 3:44    Post subject: VHost Issues(Only Uses First One) Reply with quote

Ok I am trying to run multiple websites on one IP Address and I am trying to set it up to use it all properly and then also use a default if I can get it all working. Here is what I have so far for my vhost config file.

Code:

#
# Virtual Hosts
#
NameVirtualHost *:80

<VirtualHost *>
    ServerName domain1.no-ip.org:80
    DocumentRoot C:/wamp/www/domain1/
</VirtualHost>

<VirtualHost *>
    ServerName domain2.servepics.com:80
    DocumentRoot C:/wamp/www/domain2/
</VirtualHost>

<VirtualHost *>
    ServerName domain3.serveftp.org
    ServerAlias *.domain3.serveftp.org domain3.serveftp.org
    DocumentRoot C:/wamp/www/domain3/
</VirtualHost>


I just edited out the websites since to be honest it should work for anything you put into the spots. Now I did make sure the HTTPD-Conf file is including this portion. It is listening on Port 80 but any of the other sites point me to the very first virtual host. Is there anything I am doing wrong?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 12 Dec '07 6:54    Post subject: Reply with quote

First Virtual host

<VirtualHost _default_:80>
DocumentRoot "(the exact one used in the main server config section)"
</VirtualHost>

I'm not sure everyone has to do this, from what I read over the years some do not, I've always had to to get it to work.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 12 Dec '07 10:50    Post subject: Reply with quote

There is missing the :80 after the *

<VirtualHost *:80>

namebased vhosts docs

Quote:

As a consequence, the first listed virtual host is the default virtual host. The DocumentRoot from the main server will never be used when an IP address matches the NameVirtualHost directive. If you would like to have a special configuration for requests that do not match any particular virtual host, simply put that configuration in a <VirtualHost> container and list it first in the configuration file.


Main host goes away

Quote:

f you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.


So question: Are the needed modules are loaded?
Back to top
KuraKai



Joined: 09 Nov 2007
Posts: 12

PostPosted: Thu 13 Dec '07 3:07    Post subject: Reply with quote

Funny thing, I have tried that before and it was having issues. After I posted this I tried it with the *:80 and took out the "/" at the end of the DocumentRoots and it worked. >.> Apache has the mind of it's own at times. All websites are currently working fine, got to love the AutoMagicness of some things.
Back to top


Reply to topic   Topic: VHost Issues(Only Uses First One) View previous topic :: View next topic
Post new topic   Forum Index -> Apache