如何重新启动 apache2 服务器

如何重新启动 apache2 服务器

我无法sudo service apache2 restart在服务器上运行。为了排除故障,我执行时sudo systemctl status apache2.service收到以下日志。

   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 Sat 2019-12-07 13:04:25 UTC; 7min ago
  Process: 17357 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

 apachectl[17357]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using www.domainname.
 apachectl[17357]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
 apachectl[17357]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
 apachectl[17357]: no listening sockets available, shutting down
 apachectl[17357]: AH00015: Unable to open logs
 apachectl[17357]: Action 'start' failed.
 apachectl[17357]: The Apache error log may have more information.
 systemd[1]: apache2.service: Control process exited, code=exited status=1
 systemd[1]: apache2.service: Failed with result 'exit-code'.
 systemd[1]: Failed to start The Apache HTTP Server.

我该如何解决这个问题?

注意:实际域名替换为域名

答案1

其他进程已在使用端口 80。要找出是哪个进程,请执行以下操作

netstat -tulpen | grep 80

在输出的右栏中,您将看到阻塞端口的进程的名称和 ID。为了能够启动 apache2 服务,您必须停止(或kill)它。

答案2

#/etc/init.d/apache2 重启

或者 $ sudo /etc/init.d/apache2 restart

或者 $ sudo service apache2 restart

相关内容