1.執行測試命令:
/usr/local/nginx/conf/nginx.conf.bak -t
2.如果出錯,控制台輸入的文件會輸入黃色的信息
3.分析原因:
仔細檢查目錄是否正確,正確的啟動是在sbin/下執行“./nginx”
4.正確的命令:
/usr/local/nginx/sbin/nginx -t
---------------------------------------------------------------------------
nginx -t -c /usr/nginx/conf/nginx.conf 檢查配置文件是否正常。
nginx -s quit 優雅停止nginx,有連接時會等連接請求完成再殺死worker進程
nginx -s reload 優雅重啟,並重新載入配置文件nginx.conf
nginx -s reopen 重新打開日志文件,一般用於切割日志
nginx -v 查看版本
nginx -t 檢查nginx的配置文件
nginx -h 查看幫助信息
nginx -V 詳細版本信息,包括編譯參數
nginx -c filename 指定配置文件
原文鏈接:https://blog.csdn.net/weixin_42386617/article/details/96994816