Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have apache and what not running on my local machine (mac), there also another mac on the local network. How does this other machine access my localhost?

For example I have a local website at in my vhost. How can another computer on the network navigate to this site?

share|improve this question

migrated from May 2 '10 at 4:08

This question came from our site for professional and enthusiast programmers.

What are you trying to access with ? Can you explain further ? – Romain Hippeau May 2 '10 at 0:30
This question probably belongs on ServerFault or SuperUser – Mitch Dempsey May 2 '10 at 3:53
@Mitch Dempsey: "Do not move junk".... – pauska Jul 29 '11 at 19:01

You have to edit /etc/hosts on the other mac and add a line like this:


192.168.x.x it's you LAN ip. You can retrieve it by using ifconfig command in the Terminal.

share|improve this answer

Since they are both Macs and therefore presumably have bonjour running, you may be able to use the machine's hostname directly without any further setup. Try http://{the other machine's hostname}/

share|improve this answer

You should be able to access it via your local IP address. i.e. If you're current navigating to localhost on the Server Mac to retrieve pages from the Server Mac then you instead should be navigating to 192.168.XXX.YYY on the Client Mac to retrieve pages from the server mac. You can find out your local IP address by running ifconfig in a Terminal.

share|improve this answer
The IP address will probably not work because he configured a vhost. – Raffael Luthiger Jul 29 '11 at 22:09

If you are asking if you can set things up so that one machine can talk to another machine's loopback IP (e.g. then the answer is that it cannot be done directly, and it is probably a bad idea.

share|improve this answer

This is assuming the local Apache instance is only listening on localhost, eg, otherwise just access it using the machine's IP on the network.

You can use a SSH tunnel.

You can use the -L [bind_address:]port:host:hostport paramater to creat tunnels. See: man ssh

Lets say your local mac has the ip address of and the other mac has the ip address of and the local Apache instance is running on port 80 you could use something along the lines of: ssh -L 10080: user@ from the other mac.

This can get confusing but essentially 10080 represents a port created on the other mac (this is can be any free port number, need to be admin to be a lower port number), and represents what will be forwarded to the other mac from's perspective.

To browse the website hosted on your mac, from the other mac, navigate to

Please let me know if you need any additional clarification.

share|improve this answer

Your Answer


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