Page 1 of 1

Virtual hosts xampp

PostPosted: 29. May 2010 11:45
by jootn
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

Re: Virtual hosts xampp

PostPosted: 29. May 2010 16:01
by Nobbie
>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?

Re: Virtual hosts xampp

PostPosted: 30. May 2010 09:39
by jootn
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 :§

Re: Virtual hosts xampp

PostPosted: 30. May 2010 10:16
by Nobbie
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.

Re: Virtual hosts xampp

PostPosted: 30. May 2010 12:11
by jootn
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.

Re: Virtual hosts xampp

PostPosted: 30. May 2010 17:01
by Mario Lanz

Re: Virtual hosts xampp

PostPosted: 30. May 2010 17:09
by JonB
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)