Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am migrating from windows to linux, and I am using ubuntu for my development now.

I installed apache and it works great; my problem isIi need to use a fully-qualified domain name to access my local webserver, ie should go to my local apache instance, rather than having to use http://localhost or

In windows this can be achieved through the host file. But not sure about linux.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Linux has a hosts file too, in /etc/hosts. The format should be both familiar and easy to work out.

share|improve this answer
this doesn't work network-wide, though, does it? something like that would be best – tekknolagi Aug 13 '11 at 5:56
It works only on the local machine. It is the job of a DNS server to make this mapping available to other computers. – uloBasEI Aug 13 '11 at 6:04
@tekknolagi: It wouldn't necessarily be "best". The question asks for the Linux equivalent of the Windows hosts file. I answered that question. When a question comes up asking "how do I provide name service for a network", I'll answer that one with something different. – womble Aug 13 '11 at 7:09
sorry... and so i upvoted your answer :) – tekknolagi Aug 13 '11 at 16:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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