有没有人知道什么原因会在Apache的错误日志中引起这个错误(特别是在Arch Linux上):
PID file /run/httpd/httpd.pid not readable (yet?) after start.
错误并没有阻止Apache正常运行(一旦它启动),但可能会显著减慢我的服务重新启动时间。任何指导将不胜感激。
/usr/lib/tmpfiles.d/apache.conf
。默认值是错误的。您需要进行更改。d /run/httpd 0755 root root -
为了
d /run/httpd 0755 http http -
重启apache后,PID文件将会以chown http:http
的权限创建,而不是chown root:root
。
资源:
最近几天,我的Apache服务器正在从包发行版本进行编译在启动后,PID文件*.pid无法读取(尚未?)
httpd-2.4.12.tar.gz
。以下是我的httpd.service内容,按照此方式解决了我的问题。希望这可以帮助任何遇到类似问题的人。[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start -DFOREGROUND
PIDFile=/run/apache/apache.pid
ExecReload=/usr/local/apache/bin/apachectl restart
ExecStop=/user/local/apache/bin/apachectl stop
PrivateTmp=True
[Install]
WantedBy=multi-user.target
Type=simple
。此外,不需要PIDFile
。 - rumpelsepp
/run/httpd
存在吗(并且您想把 pid 文件放在那里吗?) (2) 对于 Apache 运行的任何用户,它是否可写? - Wrikken/run/httpd
存在。Apache 正在以用户组 http:http 运行,但 pid 文件的模式是 root:root。为什么 systemd 会将 pid 文件创建为 root:root?有没有办法更改这个设置? - Charlieroot
身份运行(除非您实际上将Apache作为HTTP用户而不是作为root启动,也可以参见此处有关User指令的注释)。一种选择是使用更理想的umask(使pid文件可读,但不可写入http
)。 - Wrikken<IfModule !mpm_netware_module> <IfModule !mpm_winnt_module> User http Group http </IfModule> </IfModule>
- Charlieenvvars
中),但是这个问题似乎涉及到它(尽管建议编辑rd.d
脚本是我通常想避免的)。顺便问一下,你确定它会减慢启动速度吗?我认为它只会延迟/阻止启动的检测,但Apache仍然可以运行。 - Wrikken