6
Can I map an IP address and port to a domain name?
For example, I’d like to map 127.0.0.1:8000
to testdev.com
My /etc/hosts
file has
127.0.0.1 localhost
127.0.0.1:8000 testdev.com
So that when I hit testdev.com
, it refers 127.0.0.1:8000
. I tried the above one, but it doesn’t work. Any other alternative way to achieve this?
5No. The
hosts
file doesn't have anything to do with ports. – DavidPostill – 2017-03-27T13:01:50.1103What David Postill says is correct, but if you are really hoping to get rid of the
8000
port for local testing you might want to investigate setting up a reverse proxy via Apache or Nginx. That is the most common and accepted way to map a port-based address like127.0.0.1:8000
totestdev.com
. – JakeGould – 2017-03-27T13:29:54.0074Isn't this a duplicate of a dozen questions already – user1686 – 2017-03-27T13:51:14.640