apache,httpd服务启动报错解决方法【linux用日志排错方法】

  • cd /var/log

  • tail -f messages

简单说明一下:messages是系统日志,启动报错这里会有提示,tail -f 是动态查看的意思

在这里插入图片描述

  • 然后重新打开一个窗口,重启或启动httpd服务:systemctl restart httpd,然后回到日志窗口看最新日志

在这里插入图片描述

报错处理【带行号】

  • 这种有说行号的处理就比较简单了

  • 上图中看到 说配置文件中 /etc/httpd/conf/httpd.conf中265行错误,所以,现在打开文件,定位到265行

在这里插入图片描述

  • 问题定位到了,把265行注释掉,重启试试

在这里插入图片描述

  • 启动服务:systemctl start httpd, 成功

在这里插入图片描述

  • 说明一下,我之前以为把配置文件改了重启就会报错,然而发现配置文件不是关键,而是 mod_wsgi 服务,我把mon_wsgi卸载以后重启就报错了,把 mon_wsgi装上以后就重启正常了,这里这么做,只是 测试 如何看日志 以及 如果通过日志 处理报错问题。

在这里插入图片描述

  • wsgi 正确路径建议指定如下图哦:

在这里插入图片描述

etcd启动报错【journalctl定位】

=====================================================================================

  • 报错内容如下:

[root@vms160 ~]# systemctl restart etcd

Job for etcd.service failed because the control process exited with error code. See “systemctl status etcd.service” and “journalctl -xe” for details.

[root@vms160 ~]#

解决步骤


方式一【journalctl】

  • 启动报错的时候下面会提醒你输入 systemctl status httpd.servicejournalctl -xe查看详细

[root@vms160 ~]# systemctl restart etcd

Job for etcd.service failed because the control process exited with error code. See “systemctl status etcd.service” and “journalctl -xe” for details.

[root@vms160 ~]#

  • 说明

  • systemctl status httpd.service:既然服务起不来,那么看的这个状态肯定是failed的。

  • journalctl -xe:这是直接查看日志,这里面可能会有关键字

这个呢,就注意看有没有:invalid value这个开头的关键字,如果有的话,一般后面就是报错内容了

可以这样:journalctl -xe | grep "invalid value"过滤哦。

这种更实用于你知道这个配置文件,且知道这行内容是啥的情况。

如下:

[root@vms160 ~]# journalctl -xe | grep “invalid value”

7月 13 16:44:03 etcd1 bash[2559]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:44:04 etcd1 bash[2570]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:44:04 etcd1 bash[2580]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:44:44 etcd1 bash[2604]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:44:44 etcd1 bash[2615]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:44:45 etcd1 bash[2625]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:44:45 etcd1 bash[2635]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:44:45 etcd1 bash[2646]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:45:35 vms160 bash[2707]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:45:35 vms160 bash[2722]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:45:36 vms160 bash[2733]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:45:36 vms160 bash[2744]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:45:36 vms160 bash[2755]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: URL scheme must be http, https, unix, or unixs:

7月 13 16:47:21 vms160 bash[2789]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:47:21 vms160 bash[2800]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:47:21 vms160 bash[2811]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:47:22 vms160 bash[2821]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:47:22 vms160 bash[2832]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:48:00 vms160 bash[2862]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:48:00 vms160 bash[2873]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:48:00 vms160 bash[2884]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:48:00 vms160 bash[2895]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:48:01 vms160 bash[2905]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:55:11 vms160 bash[2947]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:55:11 vms160 bash[2957]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:55:12 vms160 bash[2968]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:55:12 vms160 bash[2978]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:55:12 vms160 bash[2989]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:58:07 vms160 bash[3012]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:58:07 vms160 bash[3023]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:58:07 vms160 bash[3034]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:58:07 vms160 bash[3045]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 16:58:08 vms160 bash[3055]: invalid value “http://localhost:2379,192.168.59.160:2379” for flag -listen-client-urls: parse 192.168.59.160:2379: first path segment in URL cannot contain colon

7月 13 17:25:46 vms160 bash[3244]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:25:47 vms160 bash[3254]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:25:47 vms160 bash[3265]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:25:47 vms160 bash[3275]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:25:48 vms160 bash[3286]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:37:00 vms160 bash[3310]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:37:00 vms160 bash[3320]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:37:00 vms160 bash[3330]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:37:01 vms160 bash[3341]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

7月 13 17:37:01 vms160 bash[3352]: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

[root@vms160 ~]#

  • 如上,上面已经告诉我:invalid value "http://localhost:2379,http:/192.168.59.160:2379" for flag -listen-client-urls: URL address does not have the form "host:port": http:/192.168.59.160:2379是这行代码出错了

方式二【messages】

  • 可以用这个来过滤:cat /var/log/messages |grep "invalid value"

我这就以过滤的形式来展示了

如下

[root@vms160 log]# systemctl restart etcd

Job for etcd.service failed because the control process exited with error code. See “systemctl status etcd.service” and “journalctl -xe” for details.

[root@vms160 log]#

[root@vms160 log]# pwd

/var/log

[root@vms160 log]# cat /var/log/messages |grep “invalid value”

Jul 13 17:42:45 vms160 bash: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

Jul 13 17:42:45 vms160 bash: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

Jul 13 17:42:46 vms160 bash: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

Jul 13 17:42:46 vms160 bash: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

Jul 13 17:42:46 vms160 bash: invalid value “http://localhost:2379,http:/192.168.59.160:2379” for flag -listen-client-urls: URL address does not have the form “host:port”: http:/192.168.59.160:2379

[root@vms160 log]#

报错处理【不带行号】

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注Java获取)

img

总结

这份面试题几乎包含了他在一年内遇到的所有面试题以及答案,甚至包括面试中的细节对话以及语录,可谓是细节到极致,甚至简历优化和怎么投简历更容易得到面试机会也包括在内!也包括教你怎么去获得一些大厂,比如阿里,腾讯的内推名额!

某位名人说过成功是靠99%的汗水和1%的机遇得到的,而你想获得那1%的机遇你首先就得付出99%的汗水!你只有朝着你的目标一步一步坚持不懈的走下去你才能有机会获得成功!

成功只会留给那些有准备的人!

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
得一些大厂,比如阿里,腾讯的内推名额!

某位名人说过成功是靠99%的汗水和1%的机遇得到的,而你想获得那1%的机遇你首先就得付出99%的汗水!你只有朝着你的目标一步一步坚持不懈的走下去你才能有机会获得成功!

成功只会留给那些有准备的人!

[外链图片转存中…(img-uP6dF7Q5-1713063405441)]

《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值