How to configure firewall to open port 80 in Linux

Installed nginx+mysql+php in the virtual machine, the desktop in the virtual machine can be accessed,

  1. netstat -ntlp | grep 80
  2. lsof -i:80

There is also corresponding port information.
But outside the virtual machine can not be accessed through ip access.

  1. iptables -L -n

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

Solution:
First, close the firewall

  1. service iptables stop

Not recommended

Second, open this port on the firewall.

  1. vim /etc/sysconfig/iptables
  2. -A INPUT -m state --state NEW -m tcp -p tcp --dport 80-j ACCEPT

restart iptables

  1. service iptables restart


Another: open a range of ports 22 to 80

  1. -A INPUT -m state --state NEW -m tcp -p tcp --dport 22:80-j ACCEPT

More please support: http://www.webyang.net/Html/web/article_173.html

Guess you like

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