CentOS open port 80, 8080 or open a port

  

Only 22 ports are enabled when loading the system. As a result, you can't access the website after installing Nginx+php+mysql.

iptables -L -n

Check the firewall settings and find that port 80 is not open

Since the Linux firewall is disabled by default. There are two ways, one is to turn off the firewall, and the other is to let the firewall open this port.

Turn off firewall naming:

service iptables stop (not recommended)

The steps to open port 8080 are as follows:

1. Modify /etc/sysconfig /iptables file, add the following line:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

Restart Iptables

service iptables restart

2. Restart the firewall. There are two ways to restart the firewall.

a) Take effect after reboot

Open: chkconfig iptables on

Close: chkconfig iptables off

b) Immediate effect, invalid after restart

Open: service iptables start

Close: service iptables stop

Open a range of ports 3000 to 5000

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3000:5000 -j ACCEPT

Copyright © Windows knowledge All Rights Reserved