Nginx 指令
紀錄一下 Nginx 幾個簡單常用指令
# 檢查 nginx 狀態
service nginx status
---
# 啟動 nginx
/etc/init.d/nginx start
service nginx start
systemctl start nginx
# For mac OS X
sudo nginx
---
# 關閉 nginx
/etc/init.d/nginx stop
service nginx stop
systemctl stop nginx
# For mac OS X
sudo nginx -s stop (快速關閉)
sudo nginx -s quit (正常關閉)
---
# 重新啟動 nginx
/etc/init.d/nginx restart
service nginx restart
systemctl restart nginx
# For mac OS X
sudo nginx -s reopen
---
# 重新載入 nginx
# reload 會重新載入配置檔案,Nginx服務不會中斷。而且reload時會測試conf語法等,如果出錯會rollback用上一次正確配置檔案保持正常執行。
/etc/init.d/nginx reload
service nginx reload
systemctl reload nginx
# For mac OS X
sudo nginx -s reload
---
# 找出正在運行 nginx 的程序
ps -ax | grep nginx
# 測試 nginx 設定
nginx -t
# 檢查 nginx 版本
nginx -V
參考資料
https://nginx.org/en/docs/beginners_guide.html
https://www.cyberciti.biz/faq/nginx-restart-ubuntu-linux-command/