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