centos 6.5 apache配置web应用&防火墙设置(入门级)

硬件:centos 6.5 服务器 , Dell R420 , 两个网口,一个给公网,一个给内网。

软件:apache 2.2

 

配置了virtualhost以后,用curl在本地可以访问。但是其他机器不可以。googel了一把,掌握了几个调试技巧:

1. ping ,curl 查看ip是否可通,页面是否可以抓取。netstat -tulpn , 查看端口是否处于监听状态,如果下面这样就ok,否则需要配置httpd.conf,加上Listening 80

tcp    0    0 :::80     :::*    LISTEN  

 

2. 如果端口处于监听状态,查看iptables规则,使用iptables -l , 正常情况下应该有这条:

ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http 

 表示,http协议可以通过任何接口。

如果没有,则需要用以下指令添加这条规则:

sudo iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
sudo /etc/init.d/iptables save

 

参考地址:http://stackoverflow.com/questions/10729247/apache-not-accepting-incoming-connections-from-outside-of-localhost

 

posted @ 2015-03-27 19:29  tommy.yu  阅读(449)  评论(0编辑  收藏  举报