Page 1 of 1

xampp over LAN

PostPosted: 09. May 2008 11:42
by pSouper
hi all,
I would be surprised if this hasnot been addressed a hundread time here already but I can't for the life of me find the solution - or at least recognise what I have fouds as a solution.

I have xammp on one pc along with multiple domains within the htdocs dir then develop these domains over the lan from another pc - all this is fine but I am having a (two day) nightmare getting the domains on pc1(xampp box & location of all domains) to show on pc2(lan box where I edit the domains using dreamweaver)

I think I need to configure HOSTS or all machines, edit vhosts.conf and httpd.conf but exaclty how is what's whipping me.

would anyone be so kind as to point me to one of those existing/elusive threads or explain what to do to what and how?

- many thanks
pSouper

PostPosted: 09. May 2008 14:32
by Nobbie
You should the (very good) documentation of Apache (including several examples):

http://httpd.apache.org/docs/2.0/en/vhosts/

PostPosted: 09. May 2008 14:41
by ifokkema
If the domains work properly on PC 1, it's not Apache which needs to be configured, but the hosts file on PC 2. Assuming that's Windows (you mentioned Dreamweaver), you'll need to edit C:\WINDOWS\system32\drivers\etc\hosts on PC 2
:)

PostPosted: 09. May 2008 15:25
by pSouper
thanks guys,
I had read through the Nobbie's link (I found in another thread by you) but am not graspping it properly - it's written in dummy speak but I only read dumb-ass ;)

xampp is fine on thr xampp box.
http://localhost/mydomain gives a blank white page no errors on pc2 (lan box)

If it's just hosts that needs confiuring I have tried a (large) number of things like...

127.0.0.1 localhost
and...
127.0.0.1 mydomain
and...
192.168.1.3 mydomain
and...
127.168.1.3 localhost

ALSO: I have been ensuring both machine hosts files are the same
AND: xampp box ip: 192.168.1.3 & lanbox ip = 192.168.1.4

would you know which one should work? also if httpd.conf and httpd-vhosts.conf need any work too?

EDIT:
I have also added to httpd-vhosts.conf...
NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin webmaster@localhost.mydomain.co.uk
DocumentRoot "c:/xampp/htdocs/mydomain.co.uk"
ServerName localhost.mydomain.co.uk
</VirtualHost>

EDIT2:
looking better now..
I can access mydomain from lan box now :). the index.html is a meta refresh that pushes the borwser to /subfolder/inde.php bu tthis just wants to 'save as' and not render as php (the refresh & file works fine from the xampp box) - if I make the index.html an index.php <?php phpinfo(); ?> file then it displays this correctly.

...the plot thickens as the problem disolves...

SOLVED :)

PostPosted: 09. May 2008 16:12
by pSouper
Thanks for the tips guys.
Although I'm not entirly sure of the why's and hows - it all works now.
If anyone cares to explain the why and how of it all please do - also if they spot a better solution or redundant parts to the following please do likewise.
(EDIT2 above was a problem with the domains scripts).

So here's what worked for me...
(xampp box ip: 192.1.68.1.3 & lan box ip: 192.168.1.4)

xampp box HOSTS file ...
Code: Select all
127.0.0.1      localhost
192.168.1.3   localhost
192.168.1.3   localhost.myDomainFolder
192.168.1.3   localhost.myOtherDomainFolder


lan box HOSTS file...
Code: Select all
192.168.1.3      localhost
192.168.1.3      localhost.myDomainFolder
192.168.1.3      localhost.myOtherDomainFolder


xamp box httpd-vhosts.conf...
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot "c:/xampp/"
   ServerName localhost
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin webmaster@mydomain.tld
   DocumentRoot "c:/xampp/htdocs/myDomainFolder"
   ServerName mydomain
</VirtualHost>
<VirtualHost *:80>
   ServerAdmin webmaster@myotherdomain.tld
   DocumentRoot "c:/xampp/htdocs/myOtherDomainFolder"
   ServerName myOtherdomain
</VirtualHost>


httpd.conf ...
un-comment the line..
Code: Select all
Include conf/extra/httpd-vhosts.conf


nothing to change in php.ini

hope it helps - if only me the next time i mess up ;)

PostPosted: 13. May 2008 08:11
by ifokkema
Well, good you got it to work!

However, I really recommend AGAINST referring to the xampp box as being "localhost". It's NOT localhost from your LAN PC so you should not use it as such. You will run into problems anyway if you ever install something on the LAN PC that would require localhost to point to itself.

Rather use something like:

http://xampp-box/mydomain

Just think of a proper hostname. You can then edit your hosts file on your LAN box only OR on both PC's to have xampp-box refer to the proper IP address.

PostPosted: 13. May 2008 14:17
by pSouper
thanks for the tips ifokkema.
I forgot to edit my post agasin but since a reboot it failed on me again :(
I have since got it working and re-Edited my findings above ^

I will now go bakc and work on your tips :) - then post back my findings soon