Use SSH hostname aliases in browser

Steve Bennett asked:

I set up hostname aliases in .ssh/config, which works great:

Host my-web
  HostName 515.346.96.21 

So I can do this:

ssh my-web

But in a browser, I still need to type in “http://515.346.96.21“. It would be great to be able to do “http://my-web“.

Short of using a Dynamic DNS, or writing a script to synchronise changes with /etc/hosts, is there a way to use the aliases in SSH more widely? I create and destroy VMs with different IPs pretty often, so am constantly updating ~/.ssh/config.

My answer:

You can just forget about setting aliases anywhere, if you use something like Avahi. This lets your workstation and servers (even virtual ones, if you bridged the virtual network) find each other and address each other by name.

View the full question and answer on Server Fault.

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