“ apache2.service没有激活,无法重新加载”


10

运行时sudo service apache2 reload,出现错误:

apache2.service is not active, cannot reload

输出 sudo service apache2 status

root@gamma:~# sudo service apache2 status
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
       └─apache2-systemd.conf
Active: inactive (dead) since Sat 2016-10-15 08:23:11 UTC; 2h 28min ago
 Docs: man:systemd-sysv-generator(8)
Process: 2203 ExecStop=/etc/init.d/apache2 stop (code=exited,     status=0/SUCCESS)
Process: 2185 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)

Oct 15 08:23:10 gamma systemd[1]: Starting LSB: Apache2 web server...
Oct 15 08:23:10 gamma apache2[2185]:  * Starting Apache httpd web server apache2
Oct 15 08:23:11 gamma apache2[2185]: Action 'start' failed.
Oct 15 08:23:11 gamma apache2[2185]: The Apache error log may have more information.
Oct 15 08:23:11 gamma apache2[2185]:  *
Oct 15 08:23:11 gamma apache2[2203]:  * Stopping Apache httpd web server apache2
Oct 15 08:23:11 gamma apache2[2203]:  *
Oct 15 08:23:11 gamma systemd[1]: Started LSB: Apache2 web server.
root@gamma:~# sudo service apache2 reload
apache2.service is not active, cannot reload.
root@gamma:~#

输出 error.log

root@gamma:/# sudo service apache2 force-reload
apache2.service is not active, cannot reload.
root@gamma:/# grep '15 08:23:' /var/log/apache2/error.log
root@gamma:/# zgrep -h 'Oct 15 08:23:' /var/log/apache2/error.log*
[Sat Oct 15 08:23:11.012917 2016] [ssl:emerg] [pid 2202] AH02562: Failed to configure certificate   bot.testingsite.cf:443:0 (with chain), check /etc/apache2/ssl/bot.testingsite.cf.crt
[Sat Oct 15 08:23:11.013037 2016] [ssl:emerg] [pid 2202] SSL Library Error:    error:0906D06C:PEM rou  tines:PEM_read_bio:no start line (Expecting: TRUSTED CERTIFICATE) -- Bad file contents or format -   or even just a forgotten SSLCertificateKeyFile?
[Sat Oct 15 08:23:11.013056 2016] [ssl:emerg] [pid 2202] SSL Library Error: error:140DC009:SSL rou  tines:SSL_CTX_use_certificate_chain_file:PEM lib
root@gamma:/#

我试图启用ssl证书。Namecheap为我提供了一个文件,并在..cf.crt文件上使用了它。看到此错误后,我尝试通过DCV方法进行验证。但是我仍然收到此错误。sudo service apache2 restart没有给出任何输出。


我们可以看到sudo服务apache2状态的输出吗?
曼努埃尔·阿尔瓦雷斯

@ManuelAlvarez Post编辑
9677832 '16

1
您还可以加上grep '15 08:23:' /var/log/apache2/error.log
Martin Thornton

如果没有输出,请运行zgrep -h 'Oct 15 08:23:' /var/log/apache2/error.log*
马丁·桑顿

我也尝试重新启动整个操作系统,但没有帮助。
user9677832 16-10-16

Answers:


16

apachectl stop

它将引发有关/etc/apache2/apache2.conf文件中语法错误的错误消息

改正它。

然后做

apachectl stop
/etc/init.d/apache2 start

现在可以重新加载apache2

/etc/init.d/apache2 reload

实际上,那是一个月前,我不得不重新安装OS。顺便说一句,谢谢您的回答。
user9677832 '16

这对我有用!
gthuo
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.