由于“来自...的密码失败”,Apache无法启动

时间:2018-02-16 23:08:21

标签: apache permissions root

当我尝试启动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.

为什么无法打开日志?

4 个答案:

答案 0 :(得分:1)

  • 在配置文件中设置ServerName。
  • 使用kill命令终止apache进程(因为您的日志表明该地址已被使用)。
  • 使用<SearchView android:layout_width="match_parent" android:id="@+id/search" android:paddingLeft="8dp" android:paddingRight="8dp" android:focusable="false" android:iconifiedByDefault="false" android:layout_height="wrap_content"> </SearchView> 启动Apache。

答案 1 :(得分:0)

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

尝试

  • sudo apache2ctl restart

  • sudo apachectl restart

  • sudo /etc/init.d/apache2 restart

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

  • 另请参阅:Restart apache - Ask Ubuntu

答案 2 :(得分:0)

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

答案 3 :(得分:0)

来自Digital Ocean的精彩人物:

  

您可以忽略root&#34;&#34;失败的密码&#34;这种情况下的错误 - 他们是SSH服务器,而不是Web服务器。因此,您需要从journalctl命令中删除tail并在文件中向上或向下翻页以查找有关Apache的特定行。

     

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

原来我还运行了Nginx(我已经安装了它进行了一些实验)。转为Nginx,并且能够启动Apache。

此外,特别感谢@Carlo Federico Vescovo坚持使用它。