Question

I have use nginx for reverse proxy which listen on port 80. and I have a web application listen on port 9999, I config nginx with reverse proxy to redirect client request from port 80 to port 9999.

Now I found that when access 80 port, browser will show web application response (this is correct.), however, if browser directly access 9999 port, it will also show web application response.

So, How can I configure nginx that browser can only access port 80, not port 9999. Thanks!

Was it helpful?

Solution

i will recommend you two solutions:

  1. You can bind your application to listen on localhost:9999 rather than *:9999

  2. you can edit your firewall to don't allow traffic for 9999 port and only allow for port 80. for that you can edit iptables by going to /etc/sysconfig/iptables

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top