我可以在生產環境中使用 “daemon off” 或 “master_process off” 設定來運行 nginx 嗎?
問: 我可以在生產環境中使用 "daemon off" 或 "master_process off" 設定來運行 nginx 嗎?
答: 首先,"daemon on|off" 和 "master_process on|off" 指令主要目的是用於 nginx 程式碼開發。
雖然許多人在生產環境中使用 "daemon off",但它實際上並非為此設計。不過,自 1.0.9 版本以來,在生產環境中使用 "daemon off" 運行 nginx 是相當安全的。請記住,使用 "daemon off" 時,不停機升級不是一個選項。
在開發環境中,使用 "master_process off",nginx 可以在前台運行,而無需主進程,並且可以簡單地使用 ^C (SIGINT) 終止。這有點類似於使用 'X' 命令列選項運行 Apache。但是,您絕對不應該在生產環境中使用 "master_process off" 運行 nginx。