参考:https://www.phusionpassenger.com/library/install/nginx/install/oss/rubygems_rvm/

Starting Nginx

You can start Nginx by running:

Copy$ sudo /opt/nginx/sbin/nginx
Shutting down Nginx

You can shut down Nginx by killing its PID with the kill command. To find out what Nginx's PID is, use the ps command. For example:

Copy$ ps auxw | grep nginx
root          ?        S    Jan01   : nginx: master process /opt/nginx/sbin/nginx
www-data      ?        S    Jan01   : nginx: worker process
Here we see that the Nginx master process has PID  (you can ignore the worker process), so we run:

Copy$ sudo kill 25817
Having to perform two steps is a bit cumbersome. Luckily, there is an easier way to do this. By default, Nginx creates a PID file in /opt/nginx/logs/nginx.pid. This PID file contains Nginx's current PID. So we can use a single command to shutdown Nginx:

Copy$ sudo kill $(cat /opt/nginx/logs/nginx.pid)
Restarting Nginx

Restarting Nginx is the same as shutting down Nginx, and starting it again. For example:

Copy$ sudo kill $(cat /opt/nginx/logs/nginx.pid)
$ sudo /opt/nginx/sbin/nginx

Nginx启动与停止的更多相关文章

  1. Nginx学习——Nginx启动、停止、重启和信号控制以及平滑升级

    1.Nginx 启动与停止 (1)启动方式 启动格式:Nginx可执行文件地址 -c Nginx配置文件地址 /etc/local/nginx/sbin/nginx -c /root/dufy/ngi ...

  2. Ubuntu下Nginx启动、停止等常用命令

    本文详细介绍Ubuntu下Nginx启动.停止等常用命令.在开发过程中,我们会经常的修改Nginx的配置文件,每次修改配置文件都可以先测试下本次修改的配置文件是否正确,可以利用以下命令: servic ...

  3. Nginx 启动、停止、平滑重启和平滑升级 graceful shutdown of worker processes

    Controlling nginx http://nginx.org/en/docs/control.html nginx can be controlled with signals. The pr ...

  4. nginx启动、停止重启

    启动 启动代码格式:nginx安装目录地址 -c nginx配置文件地址 例如: [root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /us ...

  5. linux配置Nginx启动,停止

    Nginx 启动.重启.停止脚本   第一步 先运行命令关闭nginx sudo kill `cat /usr/local/nginx/logs/nginx.pid`   第二步 vi /etc/in ...

  6. nginx启动,停止,重启

    Nginx的启动.停止与重启   启动 启动代码格式:nginx安装目录地址 -c nginx配置文件地址 例如: [root@LinuxServer sbin]# /usr/local/nginx/ ...

  7. nginx 启动,停止和重新加载配置

    要启动nginx的,运行可执行文件.一旦nginx的启动时,它可以通过与-s参数调用可执行来控制.使用以下语法 nginx -s signal 其中,信号可以是下列之一: stop - fast sh ...

  8. Nginx启动、停止与平滑重启

    如何启动Nginx:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 停止Nginx:可以发送向通信号给Nginx主进程的 ...

  9. Nginx启动和停止

    启动nginx [root@LinuxServer sbin]#  /usr/local/nginx/sbin/nginx     -c     /usr/local/nginx/conf/nginx ...

  10. nginx启动、停止、重启

    转自https://www.cnblogs.com/wangcp-2014/p/9922845.html 启动 启动代码格式:nginx安装目录地址 -c nginx配置文件地址 例如: [root@ ...

随机推荐

  1. SecureCRT如何调整好看的黄色

    1.常规 →默认会话→编辑默认编辑→白黑 字体为console 2.全局选项 ANSI颜色有一个 把黄色 拖过去即可

  2. Codeforces 463C Gargari and Bishops 题解

    题目出处: http://codeforces.com/contest/463/problem/C 感觉本题还是挺难的.须要好好总结一下. 计算对角线的公式: 1 右斜对角线,也叫主对角线的下标计算公 ...

  3. Maven 缺省内置变量

    1.${project.build.directory} 构建目录,缺省为target 2.${project.build.outputDirectory} 构建过程输出目录,缺省为target/cl ...

  4. ajax个人学习笔记

    1. function createXHR(){ if(typeof XMLHttpRequest != 'undefined'){ return new XMLHttpRequest(); }els ...

  5. asp.net core mvc视频A:笔记2-1.控制器定义

    方式一:以Controller结尾 方式二:不以Controller结尾 思考 默认路由规则为 运行示例(这里不需要写testcontroller,只写test就可以了) 同理测试test类中的控制器 ...

  6. sublime 插件(持续更新)

    sublime text 3创建新文件插件-AdvanceNewFile 这里要记录sublime text 3 在创建新文件时安装的插件–AdvanceNewFile ST本来自带的创建新文件的快捷 ...

  7. iOS scrollView中嵌套多个tableView处理方案

    项目中经常会有这样的需求,scrollView有个头部,当scrollView滚动的时候头部也跟着滚动,同时头部还有一个tab会锁定在某个位置,scrollView中可以放很多不同的view,这些vi ...

  8. 今天学习Ibatis,花了我一个下午的时间,程序猿呀,你上点心吧

    今天花了半天的时间完成了一个小小小的项目 烦了两个错误:第一个没有对Dao层进行实例化, 第二个错误是: 给数据表其错了名字,现在很混乱呀 不能其Content相似的名字呀! 还是等心情平复了再写日记 ...

  9. PHP代码中使用post参数上传大文件

    今天连续碰到了两个同事向我反应上传大文件(8M)失败的事情! 都是在PHP代码中通常使用post参数进行上传文件时,当文件的大小大于8M时,上传不能不成功. 首先,我想到了nginx的client_m ...

  10. 【文献阅读】Self-Normalizing Neural Networks

    Self-Normalizing Neural Networks ,长达93页的附录足以成为吸睛的地方(给人感觉很厉害), 此paper提出了新的激活函数,称之为 SELUs ,其具有normaliz ...