How to solve the problem that port 80 cannot be accessed in CentOS
There are two ways to solve the problem that port 80 cannot be accessed: 1. Turn off the firewall in CentOS; 2. , Open port 80 of the web service.
1. Turn off the firewall
Use the service iptables stop command to temporarily turn off the firewall so that you can access port 80. (Recommended to learn laravel tutorial)
service iptables stop
iptables The firewall is usually started at boot. After using the above command to temporarily close the firewall, the firewall software will still be started the next time you boot. You can use the following command Disable starting the firewall at startup:
chkconfig iptables off
However, the purpose of the firewall is to prevent malicious external access, so it is best to keep the firewall running.
2. Open port 80 of the web service
Use the following command to temporarily open port 80:
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
Restart the firewall to take effect:
service iptables restart
If you want to keep port 80 open the next time you boot up, use the following command to save the current settings:
service iptables save
This article comes from the PHP Chinese website, CentOS usage tutorial column, please pay attention to this column for more related tutorials!
The above is the detailed content of How to solve the problem that CentOS port 80 cannot be accessed. For more information, please follow other related articles on the PHP Chinese website!