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


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. Android,几款apk工具

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 可以查看到链接的设备 可以查看到wifi密码,这个也是个开源的 可以查询驾照学时进度 可 ...

  2. [BZOJ5251][九省联考2018]劈配(网络流)

    5251: [2018多省省队联测]劈配 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 33  Solved: 22[Submit][Status][ ...

  3. bzoj 2137: submultiple

                                                     Time Limit: 10 Sec  Memory Limit: 259 MB Submit: 23 ...

  4. 【推导】【贪心】XVII Open Cup named after E.V. Pankratiev Stage 4: Grand Prix of SPb, Sunday, Octorber 9, 2016 Problem H. Path or Coloring

    题意:给你一张简单无向图(但可能不连通),再给你一个K,让你求解任意一个问题:K染色或者输出一条K长路径. 直接贪心染色,对一个点染上其相邻的点的颜色集合之中,未出现过的最小的颜色. 如果染成就染成了 ...

  5. 【Trie】【kd-tree】计蒜客17122 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 I. Barty's Computer

    题意:2种操作:①往集合里添加一个串 ②给你四个小串a b c d,问你集合里有几个串S满足S=a+S1+b+c+S2+d的形式.S1 S2可以为空,并且a+S1+b=c+S2+d. 就搞四颗Trie ...

  6. 【推导】Codeforces Round #424 (Div. 1, rated, based on VK Cup Finals) A. Office Keys

    选择的钥匙一定是连续的,人和钥匙一定从左到右连续对应. 就枚举钥匙区间即可. #include<cstdio> #include<algorithm> using namesp ...

  7. JVM堆 栈 方法区详解

    一.栈 每当启用一个线程时,JVM就为他分配一个JAVA栈,栈是以帧为单位保存当前线程的运行状态 栈是由栈帧组成,每当线程调用一个java方法时,JVM就会在该线程对应的栈中压入一个帧 只有在调用一个 ...

  8. oracle数据库,mybatis批量insert,缺失values字段

    报错:### Error updating database.  Cause: java.sql.SQLException: ORA-00926: 缺失 VALUES 关键字### The error ...

  9. storm一键脚本

    1一键脚本 #!/bin/bash # 1 声明 #-------------------------------------- #请在strom/bin/下执行脚本 #supervisor-host ...

  10. PHP“Cannot use object of type stdClass as array”

    php再调用json_decode从字符串对象生成json对象时,如果使用[]操作符取数据,会得到下面的错误 错误:Cannot use object of type stdClass as arra ...