Apache 安装在非默认位置,如何重新启动?

Apache 安装在非默认位置,如何重新启动?

Apache 当前在 /usr/local/apache2/ 中运行

但是,当我输入 systemctl status httpd.service 时,我收到以下错误消息。

● httpd.service - The Apache HTTP Server    Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)    Active: failed (Result: exit-code) since Fri 2017-05-19 10:27:29 BST; 8s ago
     Docs: man:httpd(8)
           man:apachectl(8)   Process: 29368 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)   Process: 29366 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)  Main PID: 29366 (code=exited, status=1/FAILURE)

May 19 10:27:29  httpd[29366]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:80 
May 19 10:27:29  httpd[29366]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:80 
May 19 10:27:29  httpd[29366]: no listening sockets available, shutting down 
May 19 10:27:29  httpd[29366]: AH00015: Unable to open logs 
May 19 10:27:29  systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE 
May 19 10:27:29  kill[29368]: kill: cannot find process "" May 19 10:27:29 systemd[1]: httpd.service: control process exited, code=exited status=1 
May 19 10:27:29  systemd[1]: Failed to start The Apache HTTP Server. 
May 19 10:27:29 systemd[1]: Unit httpd.service entered failed state. 
May 19 10:27:29 systemd[1]: httpd.service failed.

如何在 /usr/local/apache2/ 中成功重新启动当前正在运行的 Apache

答案1

通过执行以下操作解决此问题; /usr/local/apache2/bin/apachectl stop /usr/local/apache2/bin/apachectl start

答案2

既然您已经回答了这个问题,我就描述一下是怎么回事。您有一个正在运行的 Apache,它监听端口 80,但没有 PID 文件。因此 systemctl 尝试启动并失败。当您执行 stop 时,systemctl 会终止正在运行的 Apache 进程,然后您启动新进程。

相关内容