2

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?

Kristian
  • 21,204
  • 19
  • 101
  • 176

2 Answers2

2

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
Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390
1

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.

soulkphp
  • 3,753
  • 2
  • 17
  • 14