Create domain name

2

1

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

juanefren

Posted 2010-08-02T21:50:21.703

Reputation: 287

Used parenthesis between http because, due my low reputation was not posible to post more than one link. – juanefren – 2010-08-02T21:51:39.020

You just have to format the URLs as code like Lawrence did for you. – Felix – 2010-08-02T22:19:18.360

Answers

2

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.)

Lawrence Velázquez

Posted 2010-08-02T21:50:21.703

Reputation: 929

2aliases 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 – 2010-08-02T22:21:11.040

1I do not believe having multiple entries for 127.0.0.1 affects the use of "localhost". – Lawrence Velázquez – 2010-08-03T01:50:03.847

i agree, multiple entries for 127.0.0.1 is fine – bryan – 2010-08-04T05:22:43.053

0

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

raspi

Posted 2010-08-02T21:50:21.703

Reputation: 911