Linux 环境下,Apache 正常安装,httpd.conf也已正常配置,经测试80端口也已开通,但在外网测试时仍然是提示503错误。经过查资料和分析怀疑是SELinux的原因,于是查看果然是:
[root@ logs]# /usr/sbin/getsebool -a |grep httpd_can_network_connect
httpd_can_network_connect --> off
于是尝试解决方案:
我们需要将httpd_can_network_connect设置为on:
[root@ logs]# /usr/sbin/setsebool -P httpd_can_network_connect=1
[root@ logs]# /usr/sbin/getsebool -a |grep httpd_can_network_connect
httpd_can_network_connect --> on
重新访问,页面果然可以访问了。
另外直接关掉SELinux也是可以解决这个问题的:
修改/etc/selinux/config 然后重启:
SELINUX=disabled
或者实时生效的方式:
[root@ linux]# /usr/sbin/setenforce 0
CentOS 6.5安装Apache服务器后无法访问解决方法:http://www.linuxdiyf.com/linux/11469.html
Ubuntu取消Apache及MySQL等自启动:http://www.linuxdiyf.com/linux/640.html