牧羊岛

懒是不会有好果子吃滴//

导航

SELinux配置不当导致httpd无法在非80端口启动

Posted on 2013-06-27 10:05  牧羊岛  阅读(2069)  评论(0)    收藏  举报

检测是否为selinux导致httpd启动失败,若setenforce 0以后就可以启动,就表示selinux配置不当。

首先本机要支持semanage命令,安装方法网上有。

semanage  port -l | grep http  //查看润徐httpd的端口

[root@localhost logs]# semanage  port -l | grep http
http_cache_port_t              tcp      3128, 8080, 8118, 11211, 10001-10010
http_cache_port_t              udp      3130, 11211
http_port_t                    tcp      80, 443, 488, 8008, 8009, 8443
pegasus_http_port_t            tcp      5988
pegasus_https_port_t           tcp      5989

semanage port -a -t http_port_t -p tcp 81  //添加81端口

http_port_t                    tcp      81, 80, 443, 488, 8008, 8009, 8443

再看就有了,然后

[root@localhost logs]# setenforce 1
[root@localhost logs]# service httpd start
Starting httpd: 
[root@localhost logs]# service httpd status
httpd (pid  21673) is running...

开机启动

chkconfig httpd on

--------------------------------

页面错误

httpd You don't have permission to access / on this server. 

日志显示

Permission denied: /home/airc/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

解决

chmod -R 755 /home/airc/

原因DocumentRoot的父目录权限错误