nginx停止,平滑重启命令

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;
        }
    }
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值