0

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?

Eugene
  • 259
  • 1
  • 4
  • 16

2 Answers2

2

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.

duffbeer703
  • 20,077
  • 4
  • 30
  • 39
Chopper3
  • 100,240
  • 9
  • 106
  • 238
  • 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
0

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/

AJ01
  • 131
  • 9