etc/hosts entry is ignored by my amazon EC2 Ubunut instant

qbq asked:

I want to add an entry for a website name to be redireected to another website. So I added the entry in the etc/hosts file. For example, let Google’s IP is and I want to to be resolved to Google’s IP. so I added:

But this is totally ignored. When I enter in an updated Chrome browser, the browser goes to and ignores the hosts entry for

The experiment is successful in my own PC but does not work in my Amazon EC2 instant.

Can you explain why etc/hosts entry is ignored by my Amazon EC2 instant? How to fix this issue please?

My answer:

You’ve entered them in reverse. The IP address must come first, then the host names.

For example:

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.