nginx啓動、關閉、重啓及常用的命令

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
./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配置文件的路徑
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章