How can I create a domain name for local purposes?

for example I have a local web application enviroment in http://localhost:8000 but I would like to have it in http://dev instead.

I am using Ubuntu 10.04

link|improve this question

75% accept rate
Used parenthesis between http because, due my low reputation was not posible to post more than one link. – juanefren Aug 2 '10 at 21:51
You just have to format the URLs as code like Lawrence did for you. – Felix Aug 2 '10 at 22:19
feedback

2 Answers

up vote 2 down vote accepted

You should be able to use a text editor of your choosing to edit your /etc/hosts file. Add two entries that look like this:

127.0.0.1   dev
::1         dev

These hosts entries map the "dev" hostname to your machine's loopback interface (address 127.0.0.1 under IPv4, and 0:0:0:0:0:0:0:1 for IPv6). After saving, "http://dev" should behave identically to "http://localhost".

(NB: You will need superuser permissions to edit the /etc/hosts file.)

link|improve this answer
2  
aliases are the better way: 127.0.0.1 localhost dev - this way applications that rely on the name(!) localhost will still work and http:/dev will too. The port is another issue.. – mugen kenichi Aug 2 '10 at 22:21
1  
I do not believe having multiple entries for 127.0.0.1 affects the use of "localhost". – Lawrence Velázquez Aug 3 '10 at 1:50
i agree, multiple entries for 127.0.0.1 is fine – bryan Aug 4 '10 at 5:22
feedback

I'm running DNSMasq for this kind of thing. It has DHCP server too.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.