mercredi 2 septembre 2020

How to access local servers without typing like localhost:xxx?

I want to access local servers without typing localhost:xxx.

For example,

  • To use ASP.NET Core server on localhost:5000, I want to access http://asp instead of http://localhost:5000
  • To use mysql on testserv:6612, I want to run mysql -u USER -p -h http://mysql instead of ... -h http://testserv -P 6612

It's too much hassle to remember port number, setting up DNS server on my machine is too.

Any ideas?

Supplement

Environments

  • macOS Catalina (but the answer in any other distro is okay!)

Tried ideas

  • Wrote /etc/hosts, but it is not compatible with port X(
  • Set up DNS server(BIND) on my machine, but it seems using a sledge‐hammer to crack a nut :(

Aucun commentaire:

Enregistrer un commentaire