【问题标题】:Apache won't start due to "Failed password for root from ..."由于“来自...的 root 密码失败”,Apache 无法启动
【发布时间】:2018-02-16 23:08:20
【问题描述】:

当我尝试启动 apache 时出现此错误:

balter@balterbox:/etc/apache2$ sudo 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.

这里是日志:

balter@balterbox:/etc/apache2$ sudo systemctl status apache2.service
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Fri 2018-02-16 14:45:58 PST; 33s ago
  Process: 2534 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
      CPU: 34ms

balter@balterbox:~$ sudo journalctl -xe | tail
Feb 16 15:05:17 balterbox sshd[2777]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=###.###.###.###  user=root
Feb 16 15:05:19 balterbox sshd[2777]: Failed password for root from ###.###.###.### port 33812 ssh2
Feb 16 15:05:19 balterbox sshd[2779]: Connection closed by 114.32.120.181 port 47696 [preauth]
Feb 16 15:05:21 balterbox sshd[2777]: Failed password for root from ###.###.###.### port 33812 ssh2
Feb 16 15:05:24 balterbox sshd[2777]: Failed password for root from ###.###.###.### port 33812 ssh2
Feb 16 15:05:24 balterbox sshd[2777]: Received disconnect from ###.###.###.### port 33812:11:  [preauth]
Feb 16 15:05:24 balterbox sshd[2777]: Disconnected from authenticating user root 121.18.238.39 port 33812 [preauth]
Feb 16 15:05:24 balterbox sshd[2777]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=###.###.###.###  user=root
Feb 16 15:05:29 balterbox sudo[2781]:   balter : TTY=pts/2 ; PWD=/home/balter ; USER=root ; COMMAND=/bin/journalctl -xe
Feb 16 15:05:29 balterbox sudo[2781]: pam_unix(sudo:session): session opened for user root by balter(uid=0)

编辑: @Carlo 建议的结果:

balter@balterbox:~$ sudo apache2ctl restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'restart' failed.
The Apache error log may have more information.
balter@balterbox:~$ sudo apachectl restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'restart' failed.
The Apache error log may have more information.
balter@balterbox:~$ sudo /etc/init.d/apache2 restart
[....] Restarting apache2 (via systemctl): apache2.serviceJob for apache2.service failed because the control process exited with error code.
See "systemctl  status apache2.service" and "journalctl  -xe" for details.

为什么打不开日志?

【问题讨论】:

  • 从 ssh 日志中删除你的 ip
  • @CarloFedericoVescovo 不错!

标签: apache permissions root


【解决方案1】:
  • 在配置文件中设置 ServerName。
  • 使用 kill 命令杀死 apache 进程(因为您的日志显示该地址已在使用中)。
  • sudo apache2ctl start启动apache。

【讨论】:

  • 该死。我寄予厚望,但这没有用。
  • 如果我发布配置文件和日志,我想我会开始违反帖子长度!有什么建议吗?
  • 为什么不起作用? sudo apache2ctl status 的结果是什么?什么错误?
【解决方案2】:

重新启动服务器并发布 Apache 状态。

试试

  • sudo apache2ctl restart

  • sudo apachectl restart

  • sudo /etc/init.d/apache2 restart

  • 在这些命令之后发布您的 apache 日志

  • 另见:Restart apache - Ask Ubuntu

【讨论】:

  • 你可以发布你的配置文件吗?
【解决方案3】:

试试这个命令sudo killall -9 httpd 并用sudo service httpd start 启动apache。 这篇文章是关于你的问题: Apache will not restart 如果还是不行,请重新安装apache。

【讨论】:

  • 我没有httpd。
  • 你有 httpd。或者你必须安装它。
  • 如果我需要它,为什么不用apache安装?我做了sudo apt-get install lamp-server^。我一直想知道它是什么......
  • 你有它。尝试重新安装apache。使用 sudo apt-get remove apache2 --purge 和 sudo apt-get install apache2
  • 您是否尝试过我在上一个答案中写的所有建议?
【解决方案4】:

来自Digital Ocean的好人:

在这种情况下,您可以忽略“root 密码失败”错误 - 它们适用于 SSH 服务器,而不是 Web 服务器。出于这个原因,您需要从 journalctl 命令中删除 tail 并在文件中向上或向下翻页以找到一些专门关于 Apache 的行。

您添加的apache2ctl restart 的输出显示了这个问题 - 端口 80 上已经有一些东西正在侦听,因此 Apache 无法开始侦听该端口号上的连接。您可以运行sudo netstat -tnlp 之类的命令来获取正在侦听连接的正在运行进程的列表,并查找其本地地址以 :80 结尾的进程。停止相应的服务,然后再次尝试启动 Apache。

原来我也运行了 Nginx(我安装它是为了做一些实验)。关闭 Nginx,并且能够启动 Apache。

还要特别感谢 @Carlo Federico Vescovo 的坚持。

【讨论】:

  • 我是对的。您正在使用套接字,因此无法重新启动服务器。
  • 绝对。我只是不知道要杀死哪个其他服务!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-02-18
  • 2018-12-23
  • 2012-05-06
  • 2014-08-03
  • 2012-07-08
  • 1970-01-01
  • 2013-05-01
相关资源
最近更新 更多