nginx怎么启动平滑重启关闭,nginx重启


假设你的nginx的目录是:/usr/opt/nginx/sbin/nginx

假设nginx的目录是: /usr/opt/nginx/conf/www4.conf

重启的方法是:/usr/opt/nginx/sbin/nginx -c /usr/opt/nginx/conf/www4.conf

参数-c 指定了配置文件的路径,如果不指定该参数,则nginx会默认加载其按照目录的conf目录下的nginx.conf.

平滑重启:

1、检查修改后的配置文件是否正确:

/usr/opt/nginx/sbin/nginx -t -c /usr/opt/nginx/conf/www4.conf

2、kill -HUP Nginx主进程号。示例如下:

kill -HUP `cat/usr/local/webserver/nginx/logs/nginx.pid`


主要参数介绍如下:

-c </path/to/config> 为 Nginx 指定一个配置文件,来代替缺省的。

-t 不运行,而仅仅测试配置文件。nginx 将检查配置文件的语法的正确性,并尝试打开配置文件中所引用到的文件。


相关内容

    暂无相关文章