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

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

share|improve this question
    
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
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.)

share|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.. – matthias krull 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

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

share|improve this answer

You must log in to answer this question.

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