[Reprinted with the source: Qian guozheng's column http://blog.csdn.net/qianguozheng/article/details/37611859]
Problem:
Install Apache on centos. The server can be accessed on the local machine after configuration, but the IP address of the external LAN cannot be accessed.
Solution:
1. modify the configuration file/etc/httpd/CONF/httpd. conf.
<Directory "/var/www/cgi-bin">
AllowOverride none
Options none
Order allow, deny
Allow from all
</Directory>
2. Add port ing. This is the security feature of the centos system and is also the reason why it applies to servers.
Method <1>: directly modify the firewall configuration file (/etc/sysconfig/iptables)
-A input-p tcp-M state -- state new-m tcp -- dport 8080-J accept
-A input-p tcp-M state -- state new-m tcp -- dport 80-J accept
Method <2>: Modify the command
/Sbin/iptables-I input-P TCP -- dport 3306-jaccept
Save Configuration
/Etc/rc. d/init. d/iptables save
Restart service
Service iptables restart
Or/etc/init. d/iptables restart
Check status
/Etc/init. d/iptables status
Iptables automatically starts upon startup:
Enable: chkconfig iptables on Close: chkconfig iptables off
Disable the service using iptables:
Enable: Service iptables start Disable: Service iptables stop
Reference
[Http://tieba.baidu.com/p/1303031263]
[Http://www.server110.com/linux/201308/528.html]
[Http://www.2cto.com/ OS /201205/132884.html]
[Http://www.cnblogs.com/rockee/archive/2012/05/17/2506671.html]
[For more information, see http://blog.csdn.net/qianguozheng/article/details/37611859]