详解

./nginx  #打开 nginx
nginx -s reload|reopen|stop|quit #重新加载配置|重启|停止|退出 nginx
nginx -t #测试配置是否有语法错误 nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives] -?,-h : 打开帮助信息
-v : 显示版本信息并退出
-V : 显示版本和配置选项信息,然后退出
-t : 检测配置文件是否有语法错误,然后退出
-q : 在检测配置文件期间屏蔽非错误信息
-s signal : 给一个 nginx 主进程发送信号:stop(停止), quit(退出), reopen(重启), reload(重新加载配置文件)
-p prefix : 设置前缀路径(默认是:/usr/local/nginx/)
-c filename : 设置配置文件(默认是:/usr/local/nginx/conf/nginx.conf)
-g directives : 设置配置文件外的全局指令
-s signal      Send a signal to the master process.  The argument signal can be one of: stop, quit, reopen, reload.
The following table shows the corresponding system signals: stop SIGTERM
quit SIGQUIT
reopen SIGUSR1
reload SIGHUP SIGNALS
The master process of nginx can handle the following signals: SIGINT, SIGTERM Shut down quickly.
SIGHUP Reload configuration, start the new worker process with a new configuration, and gracefully shut
down old worker processes.
SIGQUIT Shut down gracefully.
SIGUSR1 Reopen log files.
SIGUSR2 Upgrade the nginx executable on the fly.
SIGWINCH Shut down worker processes gracefully.

停止

查看进程号:

$ ps -ef|grep nginx
root May23 ? :: nginx: master process /usr/local/nginx/sbin/nginx
: pts/ :: grep nginx
nobody Sep27 ? :: nginx: worker process
nobody Sep27 ? :: nginx: worker process
nobody Sep27 ? :: nginx: worker process
nobody Sep27 ? :: nginx: worker process

杀死进程:

$ kill -9 

重启

1. 验证nginx配置文件是否正确

进入nginx安装目录sbin下,输入命令:

$ ./nginx -t
…… nginx.conf syntax is ok
…… nginx.conf test is successful

看到如上显示,说明配置文件正确!

2. 重启nginx服务

进入nginx安装目录sbin下,输入命令:

# ./nginx -s reload
或者
# kill -HUP

nginx 的启动、停止与重启的更多相关文章

  1. nginx命令:启动,停止及命令参数详解

    nginx命令:启动nginx 在Windows上安装好nginx后,我们需要启动nginx服务,启动nginx服务的命令行操作主要有两种方式,即 1 C:/nginx-0.8.53>nginx ...

  2. ubuntu 14.04(desktop amd 64) nginx 安装启动停止

    sudo apt-get install nginx 关闭: sudo service nginx stop 启动: sudo nginx

  3. windows 下 nginx 的启动 停止 关闭

    停止 nginx -s stop 重新加载配置文件(改动了参数无需重启,只有执行重新加载即可)nginx -s reload 退出 停止  关闭nginx -s quit

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

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

  5. nginx 在ubuntu 上的启动,停止,重启

    vi 显示行号 :set num 在开始玩nginx之前,得先安装nginx,可以参考 <ubuntu15.10_x64 安装 nginx>   启动 sudo /usr/local/ng ...

  6. Nginx 的启动、停止、平滑重启、信号控制和平滑升级

    Nginx 的启动         假设 nginx 安装在 /usr/local/nginx 目录中,那么启动 nginx 的命令就是: [root@localhost ~]# /usr/local ...

  7. Linux(CentOS6.5)下Nginx注册系统服务(启动、停止、重启、重载等)&设置开机自启

    本文地址http://comexchan.cnblogs.com/ ,作者Comex Chan,尊重知识产权,转载请注明出处,谢谢! 完成了Nginx的编译安装后,仅仅是能支持Nginx最基本的功能, ...

  8. 【转】Nginx的启动、停止与重启

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

  9. Nginx学习系列三Nginx的启动、停止、修改配置文件后重启

    1.启动Nginx 命令规则:Ngxin的安装地址 -c Nginx的安装地址下的配置文件地址 注意:一般都在root权限下进行Nginx的启动 2.停止Nginx (1).从容停止 第一步:查看Ng ...

  10. nginx 的安装、启动、停止与重启

    一.nginx 基本介绍 1.Nginx 是单进程单线程模型,也就是启动的工作进程只有一个线程响应客户端请求,而 apache 可以在一个进程内启动多个线程响应客户端请求.所以 nginx 的内存占用 ...

随机推荐

  1. 【BZOJ4800】[Ceoi2015]Ice Hockey World Championship Meet in the Middle

    [BZOJ4800][Ceoi2015]Ice Hockey World Championship Description 有n个物品,m块钱,给定每个物品的价格,求买物品的方案数. Input 第一 ...

  2. Asynchronous programming with async and await (C#)

    Asynchronous Programming with async and await (C#) | Microsoft Docs https://docs.microsoft.com/en-us ...

  3. FICO credit score

    http://www.bankrate.com/finance/credit/what-is-a-fico-score.aspx Anyone who’s ever thought about loo ...

  4. Java面试-Hibernate总结

    1  Hibernate的检索方式 Ø  导航对象图检索(依据已经载入的对象.导航到其它对象. ) Ø  OID检索(依照对象的OID来检索对象. ) Ø  HQL检索(使用面向对象的HQL查询语言. ...

  5. 使用官方Android-support-v7在低版本上使用ActionBarActivity

    昨天晚上更新了下Android SDK Manager,发现Extras下的Android Support Library已经更新到19.1了,上网一查原来是sdk\extras\android\su ...

  6. 03-树2 List Leaves(25 point(s)) 【Tree】

    03-树2 List Leaves(25 point(s)) Given a tree, you are supposed to list all the leaves in the order of ...

  7. Ubuntu 12.04安装grub2过程中出错怎么办【转】

    本文转载自:https://zhidao.baidu.com/question/491448169666671012.html 其实是可以不用优盘启动的.但使用优盘没有风险.你的系统虽然出现==不能安 ...

  8. elasearch基础教程

    Elasticsearch基础教程     翻译:潘飞(tinylambda@gmail.com) 基础概念 Elasticsearch有几个核心概念.从一开始理解这些概念会对整个学习过程有莫大的帮助 ...

  9. Emscripten实现把C/C++文件转成wasm,wast(wasm的可读形式),llvm字节码(bc格式),ll格式(llvm字节码的可读形式)并执行wasm

    <一>˙转换 Emscripten实现把C/C++文件转成wasm,wast(wasm的可读形式),llvm字节码(bc格式),ll格式(llvm字节码的可读形式)的步骤: 最新版本的Em ...

  10. 实用jQuery代码片段

    maco精选的一些jQuery代码,也许你从中可以举一反三[代码] [JavaScript]代码001<p>002    <h3><span >★ 使用jQuery ...