开发者

Adding a host to hosts file [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

开发者_如何转开发 Improve this question

I'm trying to learn about hosts & apache a little bit. One of the things I'm trying to do myself is to add a line to /etc/hosts so that way I can access localhost in the browser

Currently, hosts contains this:

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0 localhost

Questions: 1. What does the ::1, and fe80::1%lo8 mean? 2. Are they essential to the accessing of 127.0.0.1 via typing 'localhost' in your browser? 3. What would I do to create an additional link to 127.0.0.1 typing something else in the browser, like "local", so that way both "localhost" and "local" work?


The ::1 and fe80 relate to IPv6 references to localhost.

To additional aliases like local, just chain them along in a space-separated list:

127.0.0.1 localhost local mylocalmachine someothername


Kristian, I'm not sure what those symbols mean (::1 for example), but creating host file entries is as easy as typing an IP address and then the list of domains to match.

For example:

127.0.0.1 local localhost

will match both 'local' and 'localhost' to 127.0.0.1. You could have also done the following:

127.0.0.1 local
127.0.0.1 localhost

One entry per line - use a '#' at the beginning of each line if you want to comment that line out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜