启动服务时:systemctl restart httpd.service,报错:
● httpd.service - httpd service
Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 五 2023-02-24 16:18:50 CST; 25s ago
Process: 125838 ExecStop=/bin/sh -c /usr/sbin/apachectl -f /etc/httpd/httpd.conf -k stop (code=exited, status=0/SUCCESS)
Process: 125836 ExecStartPost=/bin/sh -c /usr/bin/chown apache:apache -R /usr/local/apache2/logs/httpd.pid (code=exited, status=1/FAILURE)
Process: 125832 ExecStart=/bin/sh -c /usr/sbin/apachectl -f /etc/httpd/httpd.conf -k start (code=exited, status=0/SUCCESS)
Main PID: 40137 (code=exited, status=0/SUCCESS)
2月 24 16:18:50 localhost.zpd.com systemd[1]: Starting httpd service...
2月 24 16:18:50 localhost.zpd.com sh[125836]: /usr/bin/chown: 无法访问"/usr/local/apach…目录
2月 24 16:18:50 localhost.zpd.com systemd[1]: httpd.service: control process exited, co...=1
2月 24 16:18:50 localhost.zpd.com systemd[1]: Failed to start httpd service.
2月 24 16:18:50 localhost.zpd.com systemd[1]: Unit httpd.service entered failed state.
2月 24 16:18:50 localhost.zpd.com systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
查看/usr/local/apache2/logs目录下只有两个文件,没有 httpd.pid,创建了一个空文件,然后写入一个数字ID值,如:28976后重启解决
来源地址:https://blog.csdn.net/yfy1907/article/details/129204926