Nginx in configuration iptables attention issues

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.