Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vhost issue frustrating me

Status
Not open for further replies.

pmonett

Programmer
Sep 5, 2002
2,632
FR
Greetings,

This is my first post in this forum, and my first steps with XAMPP and Apache in general.

I am trying to set up a few virtual hosts. Going step by step, I'd like to get one working first.

My hosts file has been modified to include a line :
127.0.0.1 myserver

The httpd.conf file has been changed to include the vhosts file, and basic document root is set to D:/localhost.

The vhosts file contains the following :
Code:
NameVirtualHost *:80

<VirtualHost localhost:80>
	DocumentRoot "D:/localhost"
	ServerName localhost

	<Directory "D:/localhost">
		AllowOverride None
		Order deny,allow
		Allow from all
	</Directory>
</VirtualHost>

<VirtualHost myserver:80>
	DocumentRoot D:/localhost/myserver
	ServerName myserver

	<Directory "D:/localhost/myserver">
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>

With this, I can start the Apache server, and reach the index.html of the root directory without trouble.

However, the server returns the same index.html for the myserver link as well, and not the index.html that is in /localhost/myserver.

I am running Win7, 32-bit.

Can someone tell me what I'm doing wrong ? Thanks.

I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Found it.

It needs to be
Code:
DocumentRoot "D:/localhost/myserver"

I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Just sharing an experience I had once....

I would recommend in your hosts file that you put:


127.0.0.1 localhost myserver

That way, if I understand it correctly, the system is localhost and "myserver" is an alias.

I have had some applications, especially mail servers, where you specify configuration settings as "localhost:55555" because that's the traditional way to set it up, but when the software does a lookup on 127.0.0.1 it comes back with "myserver" and when it tries to access "myserver:55555" it comes back with an access error because that's not defined. I tried to be smart and have a localhost:55555 and a myserver:55555 and then it whines because of the duplicate port specified. My solution was to always have the machine called localhost and then alias it as many times as you want.

Just my 0.02.... YMMV :eek:)
 
Thanks for the tip !

Especially since another part of the project is to have the same machine manage 2 IP adresses. I suspect that that will become handy when I name the other virtual servers.

I've got nothing to hide, and I'd very much like to keep that away from prying eyes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top