Centos open port 80

After compiling and installing Ngnix, mysql, and PHP, I found that I couldn't access it. Later, I found that the firewall had disabled port 80. Open it: (The following reference is from: http://llhdf.javaeye.com/blog/526176)

 
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT 
 
Then save: 
#/etc/rc.d/init.d/iptables save 
 
Check to see if you already have: 
[root@vcentos ~]# /etc/init.d/iptables status 
Table: filter 
Chain INPUT (policy ACCEPT) 
num  target     prot opt source               destination         
1    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:80 
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80 
3    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0           
 
Chain FORWARD (policy ACCEPT) 
num  target     prot opt source               destination         
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0
2. Restart the computer.
 
1. CentOS operating system firewall has opened ports 80 and 22 by default
 
2. It is also possible not to restart the computer here:
#/etc/init.d/iptables restart
To turn off the firewall, turn off its services:
 
3. View firewall information:
#/etc/init.d/iptables status
 
4. Turn off the firewall service:
#/etc/init.d/iptables stop
 
3. Permanently close the firewall
 
We can also permanently turn off the firewall, but I do not recommend that you do this. Permanently turning off the firewall can be done like this:
#chkconfig –level 35 iptables off
can also be modified directly
/etc/sysconfig/iptables
add a
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326802885&siteId=291194637