nginx 运行 作为 root 和用户(不能杀死用户)
nginx running as root and user (cant kill user)
ubuntu@Nginx:~$ ps -ef |grep nginx
root 1854 1 0 07:46 ? 00:00:00 nginx: master process /usr/sbin/nginx
www-data 1855 1854 0 07:46 ? 00:00:00 nginx: worker process
www-data 1856 1854 0 07:46 ? 00:00:00 nginx: worker process
www-data 1857 1854 0 07:46 ? 00:00:00 nginx: worker process
www-data 1858 1854 0 07:46 ? 00:00:00 nginx: worker process
ubuntu 1880 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
ubuntu@Nginx:~$ sudo service nginx stop
ubuntu@Nginx:~$ ps -ef |grep nginx
ubuntu 1895 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
ubuntu@Nginx:~$ ps -ef |grep nginx
ubuntu 1897 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
ubuntu@Nginx:~$ ps -ef |grep nginx
ubuntu 1899 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
我上次从头开始安装时发生过这种情况,但我不记得我是如何修复它的。当我启动时,我得到 nginx 运行 作为我的用户?我不确定如何或为什么会不断更改其 PID。我看不到能够杀死它,它似乎在干扰 nginx(它不再 运行 正确)。
编辑我 运行 自己杀死 -9,当我重新登录时,我的过程又是 运行。什么地方可以像我一样开始这件事?
在(成功)停止 nginx 进程后,您误读了 ps | grep
的输出:
ubuntu 1895 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
这不是 nginx 服务器,它 grep
匹配 本身 因为它还包含单词 "nginx" 在其命令行上,您正在搜索该词。这也是 PID 变化的原因:你每次都开始一个新的 grep
。
如果您想从结果中省略 grep
,试试这个:
$ ps -ef | grep nginx | grep -v grep
(-v grep
表示 "don't match any lines that contain the word 'grep")
ubuntu@Nginx:~$ ps -ef |grep nginx
root 1854 1 0 07:46 ? 00:00:00 nginx: master process /usr/sbin/nginx
www-data 1855 1854 0 07:46 ? 00:00:00 nginx: worker process
www-data 1856 1854 0 07:46 ? 00:00:00 nginx: worker process
www-data 1857 1854 0 07:46 ? 00:00:00 nginx: worker process
www-data 1858 1854 0 07:46 ? 00:00:00 nginx: worker process
ubuntu 1880 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
ubuntu@Nginx:~$ sudo service nginx stop
ubuntu@Nginx:~$ ps -ef |grep nginx
ubuntu 1895 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
ubuntu@Nginx:~$ ps -ef |grep nginx
ubuntu 1897 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
ubuntu@Nginx:~$ ps -ef |grep nginx
ubuntu 1899 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
我上次从头开始安装时发生过这种情况,但我不记得我是如何修复它的。当我启动时,我得到 nginx 运行 作为我的用户?我不确定如何或为什么会不断更改其 PID。我看不到能够杀死它,它似乎在干扰 nginx(它不再 运行 正确)。
编辑我 运行 自己杀死 -9,当我重新登录时,我的过程又是 运行。什么地方可以像我一样开始这件事?
在(成功)停止 nginx 进程后,您误读了 ps | grep
的输出:
ubuntu 1895 1772 0 07:47 pts/4 00:00:00 grep --color=auto nginx
这不是 nginx 服务器,它 grep
匹配 本身 因为它还包含单词 "nginx" 在其命令行上,您正在搜索该词。这也是 PID 变化的原因:你每次都开始一个新的 grep
。
如果您想从结果中省略 grep
,试试这个:
$ ps -ef | grep nginx | grep -v grep
(-v grep
表示 "don't match any lines that contain the word 'grep")