当然就仅仅是介绍一条命令了,就这么简单。


nginx默认创建一个工作进程

root      2713     1  0 07:56 ?        00:00:00 nginx: master process ../sbin/nginx
nobody 2714 2713 0 07:56 ? 00:00:00 nginx: worker process

改动worker_processes=10。来创建多个进程

#user  nobody;
worker_processes 10; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; pid logs/nginx.pid; events {
worker_connections 1024;
}

fuhui@ubuntu:/usr/local/nginx$ ps -ef | grep 'nginx'
root 2713 1 0 07:56 ? 00:00:00 nginx: master process ../sbin/nginx
nobody 2747 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2748 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2749 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2750 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2751 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2752 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2753 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2754 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2755 2713 0 08:00 ? 00:00:00 nginx: worker process
nobody 2756 2713 0 08:00 ? 00:00:00 nginx: worker process
fuhui 2852 2332 0 08:29 pts/6 00:00:00 grep --color=auto nginx

错误的运行方式
fuhui@ubuntu:/usr/local/nginx$ sudo ps -ef | grep 'nginx' | awk '{kill -9 $2}'

正确的运行方式
fuhui@ubuntu:/usr/local/nginx$ sudo kill ` ps -ef | grep 'nginx' | awk '{print $2}' `

To kill all Nginx Processes

kill $(ps aux | grep '[n]ginx' | awk '{print $2}')

使用“跟$()效果是一样的

Linux-Nginx-关闭进程的更多相关文章

  1. Linux查看关闭进程

    ps:进程的静态列表(Process status) - PID:进程号,每个进程独一无二的标识符(关闭进程需要使用) - TTY:终端所属,表明进程产生于哪一个终端,对于多用户使用的Linux服务器 ...

  2. linux kill 关闭进程命令

    杀死进程最安全的方法是单纯使用kill命令,不加修饰符,不带标志. 首先使用ps -ef命令确定要杀死进程的PID,然后输入以下命令: # kill -pid 注释:标准的kill命令通常都能达到目的 ...

  3. linux批量关闭进程

    ps aux | grep gunicorn_api | awk '{print $2}' | xargs kill -9 gunicorn 换成你的关键字即可.

  4. linux nginx启动 重启 关闭命令

    启动操作 nginx -c /usr/local/nginx/conf/nginx.conf -c参数指定了要加载的nginx配置文件路径 停止操作停止操作是通过向nginx进程发送信号来进行的 步骤 ...

  5. linux 下python进程查看及关闭

    查看进程 ps -ef |grep python 关闭进程 kill -9 26879 其中26879为进程号. linux下后台执行某个python脚本 nohup python -u xxx.py ...

  6. Linux系统Tomcat进程使用shutdown无法关闭进程

    问题场景: 若在应用中启动了用户线程,在Linux系统Tomcat进程使用shutdown无法关闭进程. 解决方案: #1.在catalina.sh文件中添加CATALINA_PID [root@lo ...

  7. linux 查看端口占用情况并关闭进程

    首先要搞清楚 linux 查看进程和查看端口是两个概念,一般来讲进程会有多个,而固定端口只会有一个. 1.查看进程 ,通常在使用 ps   命令后 用管道连接(ps -ef|grep  xxx ) 查 ...

  8. LNMP(linux+nginx+mysql+php)服务器环境配置

    一.简介 Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为 “engine X”, 是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/SMTP 代理服 ...

  9. linux+nginx+mysql+php

    LNMP(linux+nginx+mysql+php)服务器环境配置   一.简介 Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为 “engine X”, 是一个高性能的 ...

  10. Nginx的进程模型及高可用方案(OpenResty)

    1. Nginx 进程模型简介 Nginx默认采用多进程工作方式,Nginx启动后,会运行一个master进程和多个worker进程.其中master充当整个进程组与用户的交互接口,同时对进程进行监护 ...

随机推荐

  1. <四边形不等式优化>[NOI1995]石子合并

    留个坑 挺套路的 明天来写个总结 #include<cstdio> #include<algorithm> inline int read() { int x = 0,f = ...

  2. luogu P1979 华容道

    solution 被假hash可了半天....sadQAQ code // luogu-judger-enable-o2 #include<queue> #include<cstdi ...

  3. AGC 026 C - String Coloring

    题面在这里! 比较简单的折半搜索,推一下hash函数,要求正反最后相等就行了. #include<bits/stdc++.h> #define ll unsigned long long ...

  4. 【动态规划+高精度】mr360-定长不下降子序列

    [题目大意] 韵哲君发现自己的面前有一行数字,当她正在琢磨应该干什么的时候,这时候,陈凡老师从天而降,走到了韵哲君的身边,低下头,对她耳语了几句,然后飘然而去. 陈凡老师说了什么呢,陈凡老师对韵哲君说 ...

  5. [bzoj1008](HNOI2008)越狱(矩阵快速幂加速递推)

    Description 监狱有连续编号为1...N的N个房间,每个房间关押一个犯人,有M种宗教,每个犯人可能信仰其中一种.如果相邻房间的犯人的宗教相同,就可能发生越狱,求有多少种状态可能发生越狱 In ...

  6. Codeforces Round #127 (Div. 1) E. Thoroughly Bureaucratic Organization 二分 数学

    E. Thoroughly Bureaucratic Organization 题目连接: http://www.codeforces.com/contest/201/problem/E Descri ...

  7. Hiho----拓扑排序

    拓扑排序·一 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 由于今天上课的老师讲的特别无聊,小Hi和小Ho偷偷地聊了起来. 小Ho:小Hi,你这学期有选什么课么? 小H ...

  8. Nand Flash与Nor

    转:http://www.360doc.com/content/11/1215/15/1299815_172458274.shtml Flash经常在一些地方被提到,一直没认真去理解它们的区别,因此, ...

  9. Nao 类人机器人,Aldebaran Robotics公司

    Nao 类人机器人,Aldebaran Robotics 公司,被SOFTBANK 收购,阿里巴巴.富士康参股. https://www.aldebaran.com/en   一家法国的公司. htt ...

  10. 二十四种设计模式:策略模式(Strategy Pattern)

    策略模式(Strategy Pattern) 介绍定义一系列的算法,把它们一个个封装起来,并且使它们可相互替换.本模式使得算法的变化可独立于使用它的客户. 示例有一个Message实体类,对它的操作有 ...