Apache VirtualHosts

They have: 222 posts

Joined: Sep 1999

I'm getting the following error when starting Apache 2.0.54:

Quote:
The Apache service named reported the following error:
>>> [Wed Aug 10 22:49:14 2005] [warn] _default_ VirtualHost overlap on port 80, the first has precedence .

Here are the relevant statements from httpd.conf

Quote:

ServerName localhost
ServerAlias *.localhost
DocumentRoot "C:/Documents and Settings/dunniana/My Documents/Web Design/"
ErrorLog "C:\Documents and Settings\dunniana\My Documents\Web Design\error.log"

ServerName cps310.local
ServerAlias cps310.local
DocumentRoot "C:/Documents and Settings/dunniana/My Documents/Web Design/CPS310"
ErrorLog "C:\Documents and Settings\dunniana\My Documents\Web Design\CPS310\error.log"

I can't figure out what's wrong... I want both sites to accept connections on :80 and redirect to the proper directory according to the domain name...

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Not too difficult to figure out. You have 1 of the sites running under another one since it is a sub-directory. Instead of
DocumentRoot ".../Web Design/"
DocumentRoot ".../Web Design/CPS310"

you need to have something like
DocumentRoot ".../Web Design/Default"
DocumentRoot ".../Web Design/CPS310"

this prevents the overlapping sites.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

They have: 222 posts

Joined: Sep 1999

...but that's the way I want it...

I want localhost to be able to browse all the folders (sites) in Web Design, and cps310 to go directory to the CPS310 site. Is there any way to do that?

I had it setup this way with an earlier version of Apache2 and it worked fine.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Try a couple of other things then.

1.) Make sure that NameVirtualHost *:80 is not commented out. If it is uncomment it and restart Apache.
2.) I would try removing the ServerName localhost & ServerAlias *.localhost from the first Vhosts. It might be confusing it. Once again restart Apache.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

They have: 222 posts

Joined: Sep 1999

Uncommenting NameVirtualHost fixed it, thanks Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.