Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: How do I let linux assign the port that nginx listens on?

$
0
0
This approach is fraught with problems for picking a port. How do you pick a random port that doesn't collide with an existing port in use? How do you prevent another application from acquiring that port between the time you pick the random port (and check that it is free) and the time you actually listen on it? I've hit both of these problems in practice.

Specifying port 0 should be allowed and it should result in the OS picking the port which is far safer (though in rare cases I've seen this fail as well).

After all, port 0 was designated for this.

-- Mike

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>