2 ms·
I 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
by necovek 2y ago
I 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.