Need Help in virtual host

Alles, was den Apache betrifft, kann hier besprochen werden.

Need Help in virtual host

Postby spicyjazz » 25. December 2007 14:30


I'm Dinesh and Im new to Apache.

With apache tutorials I had made some virtual host and I have configured the host file in windows folder. I works great, but when I test in other computer which is connected to lan, I can view only the default website but not the other virtual hosts I made. When I refer the tutorials im getting confused with it. Can u please provide a soluton for it.

My Apache httpd.conf files goes here


ServerName "site1"
DocumentRoot "SitePath"

ServerName "site2"
DocumentRoot "SitePath"

ServerName "Site3"
DocumentRoot "SitePath"

ServerName "Site4"
DocumentRoot "SitePath"

My Hosts File is configured like this localhost site1 site2 site3 site4

All the sites are working great but when tested in lan or other computer which is connected through lan it doesn't show anything. can u please provide a solution for it.

If possible can u please provide solution for not only intranet as well as internet if possible.

Awaiting for your response.

Posts: 1
Joined: 25. December 2007 14:25

Postby glitzi85 » 22. January 2008 01:26


Neither this can work as a fact of wrong Syntax, nor will this work in Internet, as of using the Loopback Address in the VirtualHosts. Use this Syntax for general use:

Code: Select all
NameVirtualHost *

<VirtualHost *>
   ServerName site1
   DocumentRoot /absolute/path/to/site1

And so on for the other sites. If you want to keep your localhost, you need to define one VirtualHost-Block for the localhost (with the Path you will find in the DocumentRoot-Settings also in yout httpd.conf).

Just for Information. If the Apache Webserver get's a request with an URL he can not find in one VirtualHost-Block, he will use the first Block, so be careful what you write on the first position.

@Mods: Wäre der Beitrag im Englischen Teil nicht besser aufgehoben?

User avatar
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Return to Apache

Who is online

Users browsing this forum: No registered users and 3 guests