一次排除apache2不能启动的过程:

现象:

  不能启动apache2,执行/etc/init.d/apache2 start显示ok,但是用ps -e查看没有这个进程。

找原因:

  网上搜资料,有人说可能是80端口被占用,也有可能是加载的模块有问题。前者会显示busy提示,后者比如某个配置dll,或者由于客户端问题,导致winsock的问题原文,没有结果,但是提供了一些思路就是查找log。
  ubuntu中的服务查找相关命令有:systemctl status xx服务,比如systemctl status apache2.service 和journalctl -xe,还有就是/var/log/apache2/error.log。
  通过以上文件查找到一些蛛丝马迹,比如有一个陌生的wsgi模块,在log文件中显示
  
[Wed Nov 09 09:39:33.676196 2016] [wsgi:crit] [pid 4286:tid 3074931264] mod_wsgi (pid=4286): The mod_python module can not be used on conjunction with mod_wsgi 4.0+. Remove the mod_python module from the Apache configuration.
AH00016: Configuration Failed

  于是在/etc/apache2/mod-enable/中将wsgi的连接删除,无果,接着删除python链接,也无果,后面删除/lib/systemd/system/apache2.service.d/apache2-systemd.conf也无果。
  最后在systemctl status apache2.service命令中发现:
11月 09 11:12:09 hanhj-Founder-PC apache2[10383]: * The apache2 configtest failed.
11月 09 11:12:09 hanhj-Founder-PC apache2[10383]: Output of config test was:
11月 09 11:12:09 hanhj-Founder-PC apache2[10383]: AH00526: Syntax error on line 10 of /etc/apache2/conf-enabled/cobbler.conf:
11月 09 11:12:09 hanhj-Founder-PC apache2[10383]: Invalid command ‘WSGIScriptAliasMatch’, perhaps misspelled or defined by a module not included in the

  在这句话中发现一个cobber.conf文件,查找该文件日期,与发现异常的日期大致差不多,于是在删除/etc/apache2/conf-enbaled/cobber.conf该文件,可以了。回想此前浏览一个网站,计算机硬盘总是在响,而且速度奇慢,网页也崩溃了,后来就出现这种情况,重启也不管用。

最后结果:

  删除/etc/apache2/conf-enbaled/cobber.conf文件,恢复/lib/systemd/system/apache2.service.d/apache2-systemd.conf,恢复/etc/apache2/mod-enables/python.load,删除该目录下的wsgi.conf,wsgi.load文件。

结论:

  如果apache出现不能启动,可能是配置出现了问题,在/etc/apache2目录下检查是否有最新的文件出现。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值