4 ms·
Everybody loves their random port numbers these days, but I still prefer custom hostnames. Just chuck an entry into your hosts file and tell your web server to
by jasonkester 2y ago
Everybody loves their random port numbers these days, but I still prefer custom hostnames.
Just chuck an entry into your hosts file and tell your web server to sniff for it and you’re done. Run your stuff on port 80 like nature intended and never have to teach either end of your app how to deal with colons and numbers in domain names.
And you get to skip the six paragraphs of pain the other commenters are describing, orchestrating their kubernetes and whatnot.
e.g.: http://dev.whatever/ http://dev.whatever/
- necovek 2y agoI like to combine both locally — bind to port 0 to get an arbitrary unprivileged port, and use domains in /etc/hosts for easier configuration ;-) For those not familiar with what you are talking about, you can add things like the following to your /etc/hosts file: 127.0.1.1 foo.local 127.0.2.4 foo.bar.local ... They will all resolve to local host, so make sure to bind your services to those IP addresses (eg. `nc -l 127.0.2.4 80` will bind only to 127.0.2.4 on port 80). But running on unprivileged ports like 80 means you've got to run the server as root.
- pacifika 2y agoThis is the right answer. But use the .test domain as this is meant for the usecase.