参考: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. <<= 什么意思?|=什么意思?

    <<= 什么意思?|=什么意思?   x <<= 2; // x = x << 2; y |= 8; // y = y | 8;   这些都是被缩写了!位运算-- ...

  2. Calculation 2-欧拉函数的运用

    Calculation 2 Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Submit ...

  3. apt-update 更新失败 (无法连接到ubuntu服务器)

    解决方法: 找一个可以更新的系统,拷贝里面的sources.list文件,并将原系统的sources.list进行备份.

  4. HTTP协议断点续传

    using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;usi ...

  5. windows小游戏之扫雷技巧

    通过单击即可挖开方块.如果挖开的是地雷,则您输掉游戏. 如果方块上出现数字,则表示在其周围的八个方块中共有多少颗地雷.

  6. CentOS LVS安装配置

    一般2.6.10以上内核版本都已经自带了ipvsadm,故不需要安装. Ipvs 1.25编译 ipvsadm-1.25编译不过 去掉netlink库的依赖:去掉libipvs/Makefile的CF ...

  7. docker 让容器执行命令 与 进入容器交互

    直接执行命令docker exec mynginx cat /etc/nginx/nginx.conf 进入容器交互docker exec -it 80nginx /bin/bash

  8. setpgid()

    #include<unistd.h> int setpgid(pid_t pid,pid_t pgid); 函数作用:将pid进程的进程组ID设置成pgid,创建一个新进程组或加入一个已存 ...

  9. JLink defective

    下载了最新的JLink V622g,打开JLink命令行后,提示以下信息 The connected J-Link is defective,Proper operation cannot be gu ...

  10. 通过pyenv进行多版本python管理

    1.安装pyenv brew install pyenv 2.配置.zshrc文件 export PYENV_ROOT=/usr/local/var/pyenv if which pyenv > ...