Linux CentOS 7 Firewall related

Source: Internet
Author: User

The CentOS 7 system turns on the firewall by default and does not open ports such as 80 and 8080.

Therefore, after configuring Tomcat and Nginx today, they will not be able to access each other properly

Access 80 and 8080 ports are reported: 502 error. (Bad Gateway) query the data to know the cause of the firewall.

The search learned the following command:

Systemctl Start Firewalld # startup Firewall
Systemctl Enable FIREWALLD # boot up firewall

Enter the following command when firewall is running normally

Firewall-cmd--zone=public--add-port=80/tcp--permanent #添加80端口

Firewall-cmd--zone=public--add-port=3306/tcp--permanent #添加3306端口

Firewall-cmd--query-port=80/tcp--zone=public #查询80端口是否开启

When port 8080 is turned on, Tomcat can access it normally

When Port 80 is turned on, accessing the server IP is still not normal,

Reported 302 errors, was redirected

After you close nginx, then access the IP, error is as follows:

On the server can be normal access to Nginx, display nginx Welcome page.

Linux CentOS 7 Firewall related

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.