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


nginx默认创建一个工作进程

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

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

  1. #user nobody;
  2. worker_processes 10;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. pid logs/nginx.pid;
  7. events {
  8. worker_connections 1024;
  9. }

  1. fuhui@ubuntu:/usr/local/nginx$ ps -ef | grep 'nginx'
  2. root 2713 1 0 07:56 ? 00:00:00 nginx: master process ../sbin/nginx
  3. nobody 2747 2713 0 08:00 ?
  4. 00:00:00 nginx: worker process
  5. nobody 2748 2713 0 08:00 ? 00:00:00 nginx: worker process
  6. nobody 2749 2713 0 08:00 ? 00:00:00 nginx: worker process
  7. nobody 2750 2713 0 08:00 ? 00:00:00 nginx: worker process
  8. nobody 2751 2713 0 08:00 ?
  9. 00:00:00 nginx: worker process
  10. nobody 2752 2713 0 08:00 ? 00:00:00 nginx: worker process
  11. nobody 2753 2713 0 08:00 ?
  12. 00:00:00 nginx: worker process
  13. nobody 2754 2713 0 08:00 ?
  14. 00:00:00 nginx: worker process
  15. nobody 2755 2713 0 08:00 ?
  16. 00:00:00 nginx: worker process
  17. nobody 2756 2713 0 08:00 ? 00:00:00 nginx: worker process
  18. fuhui 2852 2332 0 08:29 pts/6 00:00:00 grep --color=auto nginx

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

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

To kill all Nginx Processes

  1. 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. 【线段树/区间开平方】BZOJ3211-花神游历各国

    [题目大意] 给出一些数,有两种操作.(1)将区间内每一个数开方(2)查询每一段区间的和 [思路] 普通的线段树保留修改+开方优化.可以知道当一个数为0或1时,无论开方几次,答案仍然相同.所以设置fl ...

  2. 【SPFA】POJ3259-Wormhole

    普通的SPFA的负环判定.犯了三个错误,全部写在注释里了. #include<iostream> #include<cstdio> #include<cstring> ...

  3. java笔记之方法

    一.那么什么是方法呢? 所谓方法,就是用来解决一类问题的代码的有序组合,是一个功能模块 方法是解决一类问题的步骤的有序组合 方法包含于类或对象中 方法在程序中被创建,在其他地方被引用 二.方法的优点 ...

  4. 活动中使用提示框(Toast)

    任务名称:活动中使用Toast 任务现象:点击button时,会弹出提示框:You Click Button 步骤 1.创建一个项目,新建活动和加载布局.参考: http://8c925c9a.wiz ...

  5. [转]java框架spring中的opensessioninview有什么作用

    在hibernate中使用load方法时,并未把数据真正获取时就关闭了session,当我们真正想获取数据时会迫使load加载数据,而此时 session已关闭,所以就会出现异常. 比较典型的是在MV ...

  6. 8VC Venture Cup 2016 - Elimination Round B. Cards 瞎搞

    B. Cards 题目连接: http://www.codeforces.com/contest/626/problem/B Description Catherine has a deck of n ...

  7. Hiho---欧拉图

    欧拉路·一 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho最近在玩一个解密类的游戏,他们需要控制角色在一片原始丛林里面探险,收集道具,并找到最后的宝藏.现 ...

  8. Trie 图

    时间限制:20000ms 单点时限:1000ms 内存限制:512MB 描述 前情回顾 上回说到,小Hi和小Ho接受到了河蟹先生伟大而光荣的任务:河蟹先生将要给与他们一篇从互联网上收集来的文章,和一本 ...

  9. 微信小程序,开发者工具更新以后wxss编译错误

    出现上述错误,解决方法如下: 1.在控制台输入openVendor() : 2.清除里面的wcsc wcsc.exe 3.重启开发者工具 搞定!

  10. 使用webclient上传下载实例

    转载:http://blog.csdn.net/kevonz/article/details/5078432 using System; using System.Collections.Generi ...