Apache 无法启动,没有 httpd 错误消息

Apache 无法启动,没有 httpd 错误消息

我正在尝试在 RHEL 7 上启动 httpd 服务。

当我运行时systemctl start httpd,它失败了。

以下是 的输出journalctl -xe。httpd 没有明显的错误消息,polkitd 的错误会影响 apache 吗?我该如何解决这些问题?

Jun 10 10:59:50 localhost.localdomain polkitd[850]: Registered Authentication Agent for unix-process:4462:116143 (system bus name :1.57 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Jun 10 10:59:50 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up. 
Jun 10 10:59:50 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 10 10:59:50 localhost.localdomain kill[4468]: kill: cannot find process ""
Jun 10 10:59:50 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 10 10:59:50 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jun 10 10:59:50 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Jun 10 10:59:50 localhost.localdomain systemd[1]: httpd.service failed.
Jun 10 10:59:50 localhost.localdomain polkitd[850]: Unregistered Authentication Agent for unix-process:4462:116143 (system bus name :1.57, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)

编辑:日志输出和其他信息

以下是 的输出tail -f 10 /var/log/httpd/error_log。日志文件存储在 NFS 挂载目录中(远程托管)。我可以从运行 apache 的机器编辑这些文件,但 apache 本身似乎无法写入这些文件。

==> /var/log/httpd/error_log <==
(13)Permission denied: AH00091: httpd: could not open error log file /data/web/logs/new-error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /data/web/logs/new-error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /data/web/logs/new-error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /data/web/logs/new-error.log.
AH00015: Unable to open logs
(13)Permission denied: AH00091: httpd: could not open error log file /data/web/logs/io-new-error.log.
AH00015: Unable to open logs

编辑 2:附加日志

[root@localhost web]# sealert -a /var/log/audit/audit.log
 78% donetype=AVC msg=audit(1465576122.933:606): avc:  denied  { write } for  pid=4384 comm="httpd" name="logs" dev="0:38" ino=1060076 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=dir

**** Invalid AVC allowed in current policy ***

type=AVC msg=audit(1465576695.541:615): avc:  denied  { read } for  pid=4489 comm="httpd" name="sims" dev="0:38" ino=1060159 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=lnk_file

**** Invalid AVC allowed in current policy ***

 78% donetype=AVC msg=audit(1465576695.580:616): avc:  denied  { read } for  pid=4489 comm="httpd" name="sims" dev="0:38" ino=1060159 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=lnk_file

**** Invalid AVC allowed in current policy ***

type=AVC msg=audit(1465576695.581:617): avc:  denied  { write } for  pid=4489 comm="httpd" name="logs" dev="0:38" ino=1060076 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=dir

**** Invalid AVC allowed in current policy ***

100% done
found 0 alerts in /var/log/audit/audit.log

答案1

如果你的 RHEL 7 系统有 SELinux执行,您需要启用 SELinux 布尔值才能使 NFS 正常工作。要检查您的系统是否正在使用 SELinux:

# getenforce

如果上述返回执行, 请继续:

# getsebool -a | grep httpd_use_nfs

如果上述返回httpd_use_nfs --> off,请运行以下命令以永久允许 Apache 使用 NFS。

# setsebool -P httpd_use_nfs on

现在应该允许 Apache 写入这些错误日志文件。

答案2

尝试一下apachectl configtest,你会看到错误

相关内容