Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am able to access localhost by visiting my local ip in the browser from other pcs / phones, tablets, etc but I am not sure how to access the vhosts on that machine. Is there a syntax for accessing vhosts?

http://192.168.x.x // gives me localhost

I would like to be able to access something like below

http://192.168.x.x/testsite.local

Thanks

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You have to edit the hosts file on the other computers on that lan and direct the desired domain name for the vhost to your pc's ip. For linux the hosts file is at /etc/hosts, for Windows, C:\Windows\system32\drivers\etc\hosts mostly.

Suppose, your LAN IP is 192.168.0.11 and you have a vhost setup as test.yourname.com and you want to access it from other PCs on that network. Now open the hosts file as the admin on other PCs in that LAN, add the following line -

192.168.0.11      test.yourname.com

and save it. Then restart that PC. Now try to access http://test.yourname.com in any browser from those PCs and you should see the vhost that you setup in your PC.

share|improve this answer
    
k, thanks. And on a related note: stackoverflow.com/questions/6917107/…. I have to wait a few minutes to accept the answer since this is my first post. :) –  Shane Feb 10 '12 at 16:54
    
Ok. added some more details. Check it out. :) –  Bibhas Feb 10 '12 at 16:57
    
thanks again! this is amazing too - ravelrumba.com/blog/ipad-http-debugging , it works for vhosts on the iPad –  Shane Feb 10 '12 at 17:21

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.