Hosts file changes not showing their effect. I need to add a domain name alias to my localhost address so that when I type "myfictiousdomainname.com" it should request localhost:8084 address on my computer. But I made all attempts to make the hosts file work but it doesn't.

Now I need the kind of thing like I use Fiddler2 in Windows7/8 to set this domain name alias. Is there anything alike for ubuntu 12.04 or how could i otherwise setup this domain alias for a localhost address?


You can alias your host domain, which is fairly simple. You define it in /etc/hosts  wintermute.example.com

However, you will not be able to route the host to that specified port without adding it to whatever the resource calling the custom domain is. Thats not how DNS works, DNS is simply ip resolution/aliasing. Depending on how you want to look at it.

With the above example, it can be accessed via wintermute.example.com:8084

  • oh ok.. now I see that your solution works but in windows I saw that if I had in hosts file example.com then I could access using example.com (without port no.). It did worked in windows but as you say it doesn't work in ubuntu !? – Rajat Gupta Feb 5 '14 at 18:40
  • Is there anything else I could avail to make me use wintermute.example.com instead of wintermute.example.com:8084? – Rajat Gupta Feb 5 '14 at 18:42
  • You could add a port forward in IPTables, setup a reverse proxy in NGINX/Apache - are 2 examples available to you – lazyPower Feb 5 '14 at 18:59
  • would be awesome if you could add to your answer about how to do it using IPTables .. – Rajat Gupta Feb 5 '14 at 19:04
  • askubuntu.com/questions/92483/local-port-forwarding This has been answered before, and they give a pretty comprehensive answer – lazyPower Feb 6 '14 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.