Answer the question
In order to leave comments, you need to log in
How to leave open port only for localhost?
On the nginx server, a NodeJS application is proxied from port 3000. I want to leave only the 22nd and 80th ports on the server for access from outside, and close the rest so that nginx continues to proxy 3000th.
Answer the question
In order to leave comments, you need to log in
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -j DROP
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question