我正在关注数字海洋网设置子域的指南。但现在我在重新启动 apache 时遇到了麻烦。
我有以下错误:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
systemctl status httpd.service
给了我这个:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2018-04-18 18:11:36 UTC; 12s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 1679 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 1678 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 1678 (code=exited, status=1/FAILURE)
Apr 18 18:11:36 web-server systemd[1]: Starting The Apache HTTP Server...
Apr 18 18:11:36 web-server systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 18 18:11:36 web-server kill[1679]: kill: cannot find process ""
Apr 18 18:11:36 web-server systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 18 18:11:36 web-server systemd[1]: Failed to start The Apache HTTP Server.
Apr 18 18:11:36 web-server systemd[1]: Unit httpd.service entered failed state.
Apr 18 18:11:36 web-server systemd[1]: httpd.service failed.
所以我继续执行 sudo tail /var/log/httpd/error_log 并得到以下结果:
(21)Is a directory: AH00091: httpd: could not open error log file /var/www/motomart.my.
AH00015: Unable to open logs
(21)Is a directory: AH00091: httpd: could not open error log file /var/www/motomart.my.
AH00015: Unable to open logs
(21)Is a directory: AH00091: httpd: could not open error log file /var/www/motomart.my.
AH00015: Unable to open logs
(21)Is a directory: AH00091: httpd: could not open error log file /var/www/motomart.my.
AH00015: Unable to open logs
(21)Is a directory: AH00091: httpd: could not open error log file /var/www/motomart.my.
AH00015: Unable to open logs
有好心人可以帮我解决这个问题吗?我很新,不知道下一步该做什么。
Apache 配置片段如下。
<VirtualHost *:80>
ServerName portal.motomart.my
ServerAlias www.portal.motomart.my
DocumentRoot /var/www/motomart.my/public_html
ErrorLog /var/www/motomart.my/error.log
CustomLog /var/www/motomart.my/requests.log combined
</VirtualHost>
答案1
您的日志准确地告诉您 Apache 无法启动的原因:
AH00091: httpd: could not open error log file /var/www/motomart.my.
AH00015: Unable to open logs (21)Is a directory:
确保您没有尝试使用目录作为 Apache 配置中的日志文件。