Configure httpd in centos to allow normal access to the LAN

Source: Internet
Author: User

[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]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.