Usually our server for security, will not open too multi-port, as long as necessary, only open the port.
Iptables can solve our problem very well, general steps:
1. First save access to our SSH port, otherwise we will not SSH link, typing command:
Iptables-i input-p TCP--dport 22-j ACCEPT //Our commonly used SSH port is 22, we have to deal with the actual situation.
SecureCRT View SSH Port method:
2. Turn off access to all ports
Iptables-p INPUT DROP
3. Open 80-Port access
Iptables-i input-p TCP--dport 80-j ACCEPT
4. If the Ngnix and Web server are the same machine, configure the forwarding of the rule IP whitelist, otherwise it will cause Ngnix forwarding to be unsuccessful.
Iptables-a input-p tcp-s 192.168.3.24-j ACCEPT //192.168.3.24 is the IP address of this machine.
This is because the iptables default drop policy for Ngnix and the same machine as the Web server causes
Nginx in configuration iptables attention issues