Virtual hosts xampp

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Virtual hosts xampp

Postby jootn » 29. May 2010 11:45

Good afternoon,

I'm struggling with a little problem, i'll try to explain it in english:

I hava a windows server 2003 with xampp up and running

On my D partition i have a directory "www" which i can access by 'http://localhost' (localy on the server), and by 'http://servername/' true the LAN

On my Z partition i have a directory "www" which i can access by 'http://foto.localhost/' (localy on the server), i can't reach it on the LAN.

So http://servername/ works on the LAN, http://foto.servername/ doesn't...

i've changed the vhost file in the config/extra dir of apache like this:

NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot D:\www
ServerName localhost

<Directory D:\www>
IndexOptions +FancyIndexing NameWidth=*
Options Includes FollowSymLinks Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

</VirtualHost>

<VirtualHost *:80>

DocumentRoot Z:\www
ServerName foto.localhost

<Directory Z:\www>
IndexOptions +FancyIndexing NameWidth=*
Options Includes FollowSymLinks Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

</VirtualHost>



in my system32/drivers/etc/host file i have added the following two lines:

127.0.0.1 localhost
127.0.0.1 foto.localhost


It's very strange it works fine localy on the server, but not on the LAN,

Can anyone help me?

Greetings, Joachim
jootn
 
Posts: 3
Joined: 29. May 2010 11:04

Re: Virtual hosts xampp

Postby Nobbie » 29. May 2010 16:01

>So http://servername/ works on the LAN, http://foto.servername/ doesn't...

Where is foto.servername defined? Which IP is assigned to foto.servername and how?
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: Virtual hosts xampp

Postby jootn » 30. May 2010 09:39

i tought it had something to do with my dns server on my server, so i added the ip adress of the server and the name foto to my forward lookup zones?!?
don't know exactly how to do it.

But i red somewhere on the net that you have to put ip adresses in the vhost file of apache? Just replace the * whit the ip adres of the server. But that didn't work :(

Tried to change the windows host file like "127.0.0.1 foto.ip.ip.ip.ip" but didn't work also :§
jootn
 
Posts: 3
Joined: 29. May 2010 11:04

Re: Virtual hosts xampp

Postby Nobbie » 30. May 2010 10:16

jootn wrote:i tought it had something to do with my dns server on my server, so i added the ip adress of the server and the name foto to my forward lookup zones?!?
don't know exactly how to do it.


Sounds like nonsense - what to you mean by "forward lookup zones"? Do you have a DNS server installed on your PC? Which one?

jootn wrote:But i red somewhere on the net that you have to put ip adresses in the vhost file of apache? Just replace the * whit the ip adres of the server. But that didn't work :(


Because it is completely nonsense as well.

jootn wrote:Tried to change the windows host file like "127.0.0.1 foto.ip.ip.ip.ip" but didn't work also :§


As well nonsense.

So you know why foto.servername does not work: because there is no valid IP for it.

You *could* (the only workaround) put a line into the hosts files of the OTHER PCs in your LAN (you must repeat it for EACH PC in your LAN) which contains the IP of the Xampp PC. Lets assume that the Xampp PC has the LAN IP 192.168.178.20 (for example, you have to replace it by the real IP):

Code: Select all
192.168.178.20     foto.servername


where "servername" is the servername of your Xampp PC.
Nobbie
 
Posts: 8770
Joined: 09. March 2008 13:04

Re: Virtual hosts xampp

Postby jootn » 30. May 2010 12:11

thnanks for the reply,

xampp stands on a windows 2003 server with ms-dns server installed on it.

I don't have to change my hoste file of the server, cause i can do it from the dns server (host record)

My other pc's have two dns servers in their ip-configuration: the 2003 server, and the gateway...

I'm convinced that it is possible to configure the dns server on the 2003 machine, so that i don't have to change the host files of my clients in the LAN.
jootn
 
Posts: 3
Joined: 29. May 2010 11:04

Re: Virtual hosts xampp

Postby Mario Lanz » 30. May 2010 17:01

User avatar
Mario Lanz
 
Posts: 104
Joined: 13. October 2004 22:47
Location: CH, Volketswil

Re: Virtual hosts xampp

Postby JonB » 30. May 2010 17:09

First, nobbie is right, easiest fix is a host files entry.

I don't think that creating subdomain of localhost will work easily.

what happens when you ping foto.localhost on those other machines?

you might go the route many do of using .local to define a TLD that is local to your LAN, then your XAMPP server would be foto.local -- and it should cause no problems.

BTW, this is really a MS/DNS problem not an XAMPP issue.

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 57 guests