TERM, INT 快速关闭;
QUIT 从容关闭;
HUP 平滑重启,重新加载配置文件;
USR1 重新打开日志文件,在切割日志时用途较大;
USR2 平滑升级可执行程序;
WINCH 从容关闭工作进程;
【荔枝】
[root@localhost nginx]# nginx -c conf/nginx.conf
[root@localhost nginx]#
[root@localhost nginx]# ps -ef | grep nginx
root 2138 1 0 06:30 ? 00:00:00 nginx: master process nginx -c conf/nginx.conf
nobody 2139 2138 0 06:30 ? 00:00:00 nginx: worker process
nobody 2140 2138 0 06:30 ? 00:00:00 nginx: worker process
nobody 2141 2138 0 06:30 ? 00:00:00 nginx: worker process
root 2143 2083 1 06:30 pts/0 00:00:00 grep nginx
[root@localhost nginx]#
[root@localhost nginx]# ps -ef | grep nginx
root 2138 1 0 06:30 ? 00:00:00 nginx: master process nginx -c conf/nginx.conf
nobody 2139 2138 0 06:30 ? 00:00:00 nginx: worker process
nobody 2140 2138 0 06:30 ? 00:00:00 nginx: worker process
nobody 2141 2138 0 06:30 ? 00:00:00 nginx: worker process
root 2147 2083 3 06:32 pts/0 00:00:00 grep nginx
[root@localhost nginx]#
[root@localhost nginx]# kill -QUIT 2138
[root@localhost nginx]#
[root@localhost nginx]# ps -ef | grep nginx
root 2149 2083 2 06:32 pts/0 00:00:00 grep nginx
【nginx.conf 文件如下】: 第2行的 woker_processes 3; 表示nginx主进程 带有3个工作进程;
# this config is from 3-6
worker_processes 3;
events {
worker_connections 1024;
}
http
{
# first virtual host 第一个虚拟主机
server
{
# ip and port monitored 监听的ip和端口
listen 192.168.186.100:80;
# host name 主机名称
server_name 192.168.186.100;
# the dir access_log saved 访问日志文件存放路径
access_log logs/server1.access.log combined;
location /
{
# default index file, priority reduction from left to right
# 默认首页文件,顺序从左到右,
index index.html index.htm;
# the dir html file saved, html网页文件存放目录
root /data0/htdocs/server1;
}
}
# second virtual host
server
{
listen 192.168.186.101:80;
server_name 192.168.186.101;
access_log logs/server2.access.log combined;
location /
{
index index.html index.htm;
root /data0/htdocs/server2;
}
}
# third virtual host
server
{
listen 192.168.186.102:80;
server_name 192.168.186.102;
access_log logs/server3.access.log combined;
location /
{
index index.html index.htm;
root /data0/htdocs/server3.com;
}
}
}