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


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. 理解Python的迭代器(转)

    原文地址: http://python.jobbole.com/81916/ 另外一篇文章: http://www.cnblogs.com/kaituorensheng/p/3826911.html ...

  2. [BZOJ 1562] 变换序列

    Link: BZOJ 1562 传送门 Solution: 一道比较考对$Hungry$算法理解的题目 首先可以轻松看出原序列和答案序列的对应关系,从而建出二分图匹配模型 下面的关键在于如何保证字典序 ...

  3. 【搜索】bzoj3109 [cqoi2013]新数独

    搜索,没什么好说的.要注意读入. Code: #include<cstdio> #include<cstdlib> using namespace std; ][]= {{,, ...

  4. Java如何进行异常处理

    关键字:throws.throw.try.catch.finally的用法 Java通过面向对象的方法进行异常处理,把各种不同的异常进行分类,并提供了良好的接口.在Java中,每个异常都是一个对象,它 ...

  5. 一段javascript设计模式应用场景

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <hea ...

  6. 高并发环境下,Redisson实现redis分布式锁

    原文:http://tlzl0526-gmail-com.iteye.com/blog/2378853 在一些高并发的场景中,比如秒杀,抢票,抢购这些场景,都存在对核心资源,商品库存的争夺,控制不好, ...

  7. 加速 Android Studio 的编译速度 2.2

    Android studio 2.2 当中有一项新的功能:Dex In Process. 这项功能可以动态的加快编译速度,以及提高Instant Run 的效率. 那么怎么来使用这项新功能呢?你只需要 ...

  8. 【shiro】报错: If the controller requires proxying (e.g. due to @Transactional), please use class-based proxying.

    spring整合shiro,项目报如下错误: ==============异常开始============= java.lang.IllegalStateException: The mapped c ...

  9. unity3d-地图制作之云彩飘动

    首先,我先声明,关于美工制作我是一点都不了解,甚至基本上没接触过,所以今天开始我就兼并这美工加程序来学习. 当然,我只是对unity中的美术比较感兴趣而已,仅此而已. 所以,如果我在文章中讲的不对的地 ...

  10. LookupError: unknown encoding: cp65001

    在CMD下解释运行python时出现LookupError: unknown encoding: cp65001错误(编码错误) 在cmd下chcp命令(大概是change codepage?)可查看 ...