当我想重新启动centOS 6.7上的httpd服务时,我有以下错误:
/etc/init.d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: (13)Permission denied: httpd: could not open error log file /etc/httpd/logs/error_log.
Unable to open logs
[FAILED]
这是error_log:
ls -Z /etc/httpd/logs/error_log
-rw-r--r--. root root unconfined_u:object_r:var_t:s0 /etc/httpd/logs/error_log
我也禁用了selinux。
问题是什么?
httpd
可能以用户apache
或用户httpd
运行。您的日志是拥有的,只有root
可写。更改日志文件的所有权以使其工作。
这应该做的伎俩:
~# chown apache.apache /etc/httpd/logs/error_log
可能你应该将该forder的组更改为apache,不建议将root用作服务器内容的所有者。无论如何apache应该在http启动后自行改变...
来自httpd Wiki:
在开始之前,我们需要知道Apache HTTP服务器(httpd)作为特定用户和组运行。
在Linux以及大多数其他类Unix系统上,httpd作为“root”用户启动; UID = root,GID = root。这是必要的,因为只有这个用户可以绑定到端口80和443(实际上低于1024的任何东西)。
在http启动并绑定到其端口(由httpd.conf中的Listed语句定义)之后,它将用户更改为httpd.conf中指定的用户。典型:
用户:apache 组:阿帕奇
请注意,基于Debian的系统(包括Ubuntu)使用“www-data”代替。
作为一种可能的解决方案,您应该将自己添加到组apache中
usermod -a -G apache (username)
然后:
chgrp apache (folderPath)
chmod g+rwxs (folderPath)
无论如何这很奇怪...告诉我这是否解决了你的问题,如果不解决,我会编辑它,只要你提供我进一步的信息:)
只需以超级用户身份运行:
service httpd start
启动httpd:(13)权限被拒绝:httpd:无法打开错误日志文件/ etc / httpd / logs / error_log。
无法打开日志[FAILED]
sudo service httpd start
启动httpd:[确定]