I've disabled the web server on Snow Leopard, and I'm using an emulated Ubuntu with Lighttpd web server.

In order to access to the web pages I need to specify the ip of the emulated machine. However I now need to associated such ip with "localhost" in Leopard environment.

When I type localhost in Leopard I actually want to visit the localhost on the Ubuntu machine.

Do I need apache on leopard to make the forward or can I change network settings in Leopard or what?

  • 1
    Can you not reach the Ubuntu machine with its host name? Is there a reason it has to be localhost (as in, the software you are setting up requires it to be the local machine), or could it be any host name?
    – jmlumpkin
    Dec 30, 2010 at 16:51

3 Answers 3


You could add a new line to /etc/hosts to map the VM's IP to something like ubuntu. Then you could just do http://ubuntu to get to it. Still some config file modification required, but a better solution than remapping localhost that should also suit your requirements.

  • This is my recommendation in the comment, other than not knowing if whatever is running under ubuntu is checking to see if it is being requested as localhost.
    – jmlumpkin
    Dec 30, 2010 at 18:08

You don't want to do this. As you pointed out, there are warnigs in the /etc/hosts file not to change the localhost entry.

The localhost entry is meant to resolve to the local host and more specifically the loopback address On your Snow Leopard machine, localhost should resolve to your Snow Leopard machine and on your Ubuntu machine, localhost should resolve to your Ubuntu machine.

If you are trying to access the Ubuntu system from your Snow Leopard system, why don't you just use the IP address of the Ubuntu system?

  • @g . Because I need to access to a website installed on Ubuntu with the correct domain name (in this case localhost). I need to do this otherwise I have to change all settings of my local copy of Drupal + Lighttpd web server configuration file, everytime I copy it on the local machine.
    – aneuryzm
    Dec 30, 2010 at 15:57
  • 4
    @Patrick But that is exactly what you should do. On your Ubuntu machine, you should set up Drupal + Lighttpd with the local domain of your choosing (eg. mysite.dev) and add that entry in /etc/hosts/ on both the Snow Leopard and Ubuntu machines.
    – ghoppe
    Dec 30, 2010 at 17:14
  • 2
    There's a good chance you'll break some server daemon/service/app because it is looking for something at localhost and failing.
    – John Smith
    Dec 30, 2010 at 19:27

You could change your /etc/hosts file to map localhost to the IP of the VM, not to

  • 1
    The problem is that on top of that file, you will find a warning that will tell you not to change the localhost alias.
    – aneuryzm
    Dec 30, 2010 at 15:38
  • I forgot to mention that also a "shell-solution" is fine since I've to set it everytime because my emulated machine changes ip anyway. Is there a fast way to make it from shell ? thanks
    – aneuryzm
    Dec 30, 2010 at 15:39
  • Yes, I know. I would really not recommend doing this change, but would do what you were requesting.
    – jmlumpkin
    Dec 30, 2010 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .