Re: Why not /etc/hosts?
I'm not sure how that helps.
http://localhost - you get a warning in your address bar that the site is not secure
https://localhost - you get dire warnings about invalid ssl certificates, and it is very difficult to access the site unless you know what you are doing.
Install a self-signed certificate - your anti-virus software will probably go mental
The correct answer is to have your own domain, use split-horizon dns to resolve to localhost, get your own ssl certificate for it and install that. But that is too much work for the average person.