Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Today I got an idea, that testing my web apps on two different PCs would be even better if they both are near and if I could use my own localhost instead of hosting.

i.e.:
1. My ASUS laptop runs Windows 7 and XAMPP for work with localhost.
2. My desktop PC runs Windows XP.
3. They both are connected trough router.
4. There some shared folders on both.

Now what I wanted to do is to lunch XAMPP on my laptop and try to view same from my desktop through http://localhost/, but only when XAMPP on my desktop isn't launched.

Is it possible? Or if not, then maybe there are some suggestions?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

This sounds like an odd/mental idea - just put two entries in each machine's hosts file if you don't have common DNS - then refer to each by name - it'll be far easier. And no localhost only ever points to yourself unless you specifically define it otherwise at which point you're inviting a world of pain on yourself now or later - don't do that ok.

share|improve this answer
    
Great. Didn't know about such possibility. Thnak you. Just what i neede. When I have XAMPP working on laptop I just need to insert the laptop ip address to access it localhost, through desktop PC. Thank you a lot. –  Eugene Jul 17 '10 at 11:30
    
@Eugene: Just to be clear: localhost only refers to itself. Put entries in your hosts file like "desktop" and "laptop" or "fred" and "ginger". Then you'll access web pages using http://desktop/, etc. Don't try to use http://localhost/ except when accessing pages on the same machine. –  Dennis Williamson Jul 17 '10 at 14:09
    
@Dennis Williamson, got it. I tried it today. Just what I needed. Thanks. –  Eugene Jul 17 '10 at 18:57
add comment

Just to give you another way to do this;

ProxyPass /othermachine http:// otherhost/ on the XAMP apache config and there you go. If you were really neat, setup a virtual host with ProxyPass / http:// otherhost/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.