Home >Backend Development >PHP Tutorial >Common operations of Nginx

Common operations of Nginx

WBOY
WBOYOriginal
2016-07-29 09:04:241050browse

1. Start Nginx

<code>常用启动方式:
[root<span>@Admin</span> /]<span># /opt/nginx/sbin/nginx </span>
指定配置启动方式:
[root<span>@Admin</span> /]<span># /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf</span></code>

2. Stop Nginx

<code>快速停止nginx:
[root<span>@Admin</span> /]<span># /opt/nginx/sbin/nginx -s stop</span>
完整有序的停止nginx:
[root<span>@Admin</span> /]<span># /opt/nginx/sbin/nginx -s quit</span>其他的信号停止nginx的方式:
[root<span>@Admin</span> /]<span># ps -ef|grep nginx    :查询Nginx主进程号</span>
[root<span>@Admin</span> /]<span># kill -QUIT 主进程号    :从容停止Nginx</span>
[root<span>@Admin</span> /]<span># kill -TERM 主进程号    :快速停止Nginx</span>
[root<span>@Admin</span> /]<span># kill -INT主进程号      :从容停止Nginx</span>
[root<span>@Admin</span> /]<span># pkill -9 nginx       :强制停止Nginx</span></code>

3. Reload configuration

<code>修改配置文件后要先验证配置文件是否正确:
[root<span>@Admin</span> /]<span># /opt/nginx/sbin/nginx -t -c /opt/nginx/conf/nginx.conf</span><span>nginx</span>: the configuration file /opt/nginx/conf/nginx.conf syntax <span>is</span> ok
<span>nginx</span>: configuration file /opt/nginx/conf/nginx.conf test <span>is</span> successful

修改配置后重新加载生效:
[root<span>@Admin</span> /]<span># /opt/nginx/sbin/nginx -s reload</span>或者你发送一个挂起信号(信号 <span>1</span> 或 HUP)时,大多数服务器进程(所有常用的进程)都会进行复位操作并重新加载它们的配置文件:
[root<span>@Admin</span> /]<span># kill -HUP 主进程号</span></code>

4. Nginx commonly used signal control

<code><span>kill</span> -HUP 主进程号      :重启
<span>kill</span> -QUIT 主进程号     :从容关闭
<span>kill</span> -TERM 主进程号     :快速关闭
<span>kill</span> -INT 主进程号      :从容关闭
<span>kill</span> -USR1 主进程号     :切换日志文件
<span>kill</span> -USR2 主进程号     :平滑升级可执行进程
<span>kill</span> -WINCH 工作进程号   :从容关闭工作进程</code>
').addClass('pre-numbering').hide( ); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the common operations of Nginx, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn