Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

On my mac it resolve the computer-name or localhost or ipaddress of course. But i'm trying to use my phone to access the server setup on my machine but I can only resolve it using my mac's ip address but not the mac's computer name. Any reason on why this is? Also I have modified the /etc/hosts file to map my computer's ip address to name like And tried to access on my phone but it cannot resolve the dns as well. Any advice on how to proceed?

share|improve this question

migrated from Dec 24 '12 at 12:54

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

This is off-topic as it is not a programming problem. However, you should also include the model of your phone, and it's operating system. – RB. Dec 24 '12 at 12:07
up vote 2 down vote accepted

Whatever you set in your /etc/hosts only works for your local machine, not for any other machine, not even when it's in the same network.

So what you have to do in order to get the name to work is use/set the actual hostname for the machine. I'm no OSX guru, but I believe it's pretty similar to Debian systems, so it should be under /etc/hostname. You can also temporarily change it with the hostname command, like:

hostname mypc

After you've done that, you also need to make your webserver "listen" on this hostname. By default, it only listens to IP or localhost connections. You'll have to tell it that it should listen on the mypc name. There should be something like this in the default Apache configuration:

ServerName localhost

Either change that to your desired name, or add an alias for mypc right underneath that line, like this:

ServerAlias mypc

Then restart Apache and it should start listening on that name.

share|improve this answer

You must log in to answer this question.

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