Server version: Apache/2.4.41 (Ubuntu) Server built: 2020-08-12T19:46:17
报错
修改apache的配置文件后,重启apache会报错
#service apache2 restart
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
这个时候不要慌!不要重装!不要放弃!按照提示运行:
systemctl status apache2.service
我这里出现过的错误:
错误1:
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2021-05-31 21:00:24 CST; 3s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 1184602 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
May 31 21:00:23 iZwz919g91pglb4zkj97ctZ systemd[1]: Starting The Apache HTTP Server... May 31 21:00:24 iZwz919g91pglb4zkj97ctZ apachectl[1184611]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 34 of /etc/apach> May 31 21:00:24 iZwz919g91pglb4zkj97ctZ apachectl[1184602]: Action 'start' failed. May 31 21:00:24 iZwz919g91pglb4zkj97ctZ apachectl[1184602]: The Apache error log may have more information. May 31 21:00:24 iZwz919g91pglb4zkj97ctZ systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE May 31 21:00:24 iZwz919g91pglb4zkj97ctZ systemd[1]: apache2.service: Failed with result 'exit-code'. May 31 21:00:24 iZwz919g91pglb4zkj97ctZ systemd[1]: Failed to start The Apache HTTP Server.
看后面log的第二行:
apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 34 of /etc/apach>
进入配置文件中查看34行的错误,具体情况具体分析
错误2:
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2021-05-31 21:04:16 CST; 14s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 1184995 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
May 31 21:04:16 iZwz919g91pglb4zkj97ctZ systemd[1]: Starting The Apache HTTP Server... May 31 21:04:16 iZwz919g91pglb4zkj97ctZ apachectl[1185012]: AH00526: Syntax error on line 37 of /etc/apache2/sites-enabled/000-default-ssl.conf: May 31 21:04:16 iZwz919g91pglb4zkj97ctZ apachectl[1185012]: Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server> May 31 21:04:16 iZwz919g91pglb4zkj97ctZ apachectl[1184995]: Action 'start' failed. May 31 21:04:16 iZwz919g91pglb4zkj97ctZ apachectl[1184995]: The Apache error log may have more information. May 31 21:04:16 iZwz919g91pglb4zkj97ctZ systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE May 31 21:04:16 iZwz919g91pglb4zkj97ctZ systemd[1]: apache2.service: Failed with result 'exit-code'. May 31 21:04:16 iZwz919g91pglb4zkj97ctZ systemd[1]: Failed to start The Apache HTTP Server.
依旧是看log的第二行,这次加上第三行:
May 31 21:04:16 iZwz919g91pglb4zkj97ctZ apachectl[1185012]: AH00526: Syntax error on line 37 of /etc/apache2/sites-enabled/000-default-ssl.conf: May 31 21:04:16 iZwz919g91pglb4zkj97ctZ apachectl[1185012]: Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server>