nginx启动、关闭、重启及常用的命令

转自:https://blog.csdn.net/veryisjava/article/details/72917894

nginx常用命令

启动: cd /usr/local/nginx/sbin

./nginx nginx服务启动后默认的进程号会放在/usr/local/nginx/logs/nginx.pid文件

cat nginx.pid 查看进程号

关闭:

kill -TERM pid 快速停止服务

kill -QUIT pid 平缓停止服务

kill -9 pid 强制停止服务

重启:

cd /usr/local/nginx

扫描二维码关注公众号,回复: 3985137 查看本文章

./nginx -HUP pid

./nginx -s reload

另外一些常见的命令:

./nginx -h 查看nginx所有的命令参数

Options:

-?,-h : this help

-v : show version and exit

-V : show version and configure options then exit

-t : test configuration and exit

-T : test configuration, dump it and exit

-q : suppress non-error messages during configuration testing

-s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /usr/local/nginx/)

-c filename : set configuration file (default: conf/nginx.conf)

-g directives : set global directives out of configuration file

./nginx -v 显示nginx的版本号

./nginx -V 显示nginx的版本号和编译信息

./nginx -t 检查nginx配置文件的正确性

./nginx -t 检查nginx配置文件的正确定及配置文件的详细配置内容

./nginx -s 向主进程发送信号,如:./nginx -s reload 配置文件变化后重新加载配置文件并重启nginx服务

./nginx -p 设置nginx的安装路径 ./nginx -c 设置nginx配置文件的路径

猜你喜欢

转载自blog.csdn.net/y19910825/article/details/82840274