How can I set up a local host with a reasonable name, different than "localhost:80"?
I realize that the OP has a mac, and that the solutions given work for both mac and linux.
But I would also like to add that Windows has a hosts file too in C:\Windows\System32\drivers\etc\hosts
, in case someone comes here through google with the same problem and uses windows :)
The Webserver can't do that for you, as it's not responsible for DNS resolution.
You'll need to add an entry to your Hosts file (/private/etc/hosts
or /etc/hosts
depending on the version), and then perform some special MacOS X magic ritual to make it stick.
You can do this by editing /etc/hosts
(you will need to do this as administrator, e.g. sudo nano /etc/hosts
Find the line that looks like:
127.0.0.1 localhost
And add another hostname, e.g.
127.0.0.1 localhost mydomainoffline.com
(Edit: I should point out that while this works just fine for Leopard (10.5), I don't know about other versions of Mac OS X)