1、nginx的幾個命令參數
Nginx 安裝後只有一個程序文件,自己並不提供各類管理程序,它是使用參數和系統信號機制對 Nginx 進程自己進行控制的。 Nginx 的參數包括有以下幾個:
能夠這樣使用 /usr/local/nginx/sbin/nginx -參數
-c <path_to_config>:使用指定的配置文件而不是 conf 目錄下的 nginx.conf 。
-t:測試配置文件是否正確,在運行時須要從新加載配置的時候,此命令很是重要,用來檢測所修改的配置文件是否有語法錯誤。
-v:顯示 nginx 版本號。
-V:顯示 nginx 的版本號以及編譯環境信息以及編譯時的參數。
2、檢測新的conf文件
測試當請目錄下nginx.conf文件是否正確,使用命令:
nginx -t -c nginx.conf
2009/01/01 22:17:57 [info] 54240#0: the configuration file nginx.conf syntax is ok
2009/01/01 22:17:57 [info] 54240#0: the configuration file nginx.conf was tested successfully
獲得如此結果,說明新conf文件沒有錯誤。
若是有錯,他會提示你在哪行出了錯,在修改錯誤就能夠了。 nginx
平滑重啓 測試
nginx -s reload 進程