首页 文章

无法停止/重启Apache2服务

提问于
浏览
-1

试图阻止Apache2服务,但得到PID错误:

#service apache2 stop

[FAIL] Stopping web server: apache2 failed!
[....] There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Plea[warnview the situation by hand. ... (warning).

试图杀死这些进程:

#kill -9 $(ps aux | grep apache2 | awk '{print $2}')

但他们又重新产生了:

#ps aux | grep apache2
root     19279  0.0  0.0   4080   348 ?        Ss   05:10   0:00 runsv apache2
root     19280  0.0  0.0   4316   648 ?        S    05:10   0:00 /bin/sh /usr/sbin/apache2ctl -D FOREGROUND
root     19282  0.0  0.0  91344  5424 ?        S    05:10   0:00 /usr/sbin/apache2 -D FOREGROUND
www-data 19284  0.0  0.0 380500  2812 ?        Sl   05:10   0:00 /usr/sbin/apache2 -D FOREGROUND
www-data 19285  0.0  0.0 380500  2812 ?        Sl   05:10   0:00 /usr/sbin/apache2 -D FOREGROUND

虽然进程正在运行但我无法连接到端口80上的服务器./var/log/apache2/error.log.1在执行kill -9时没有新消息 . 在我尝试重新启动之前,一切都很完美 . 在Debian上运行:Linux adara 3.2.0-4-amd64#1 SMP Debian 3.2.54-2 x86_64 GNU / Linux

UPD:还试过apache2ctl:

#/usr/sbin/apache2ctl -k stop
AH00526: Syntax error on line 76 of /etc/apache2/apache2.conf:
PidFile takes one argument, A file for logging the server process ID
Action '-k stop' failed.
The Apache error log may have more information.

但/ var / run / apache2中没有pid文件

我是linux的新手,看起来它必须对启动脚本做一些事情,但无法弄清楚到底是什么 .

2 回答

  • 0

    以下是查找在端口80上运行的进程的命令

    lsof -i tcp:80

    使用PID终止进程 . 重新启动系统一次以检查它们是否是正在执行的任何启动脚本并使用阻止您启动服务的端口80 .

    对于启动脚本,您可以检查

    /etc/init.d/或/etc/rc.local或crontab - e

  • 1

    您可以尝试使用Apache官方文档进行停止/重启操作 . link

相关问题