我使用的是yum 安裝的Nginx(.rpm)
使用的配置文件爲源目錄下配置文件 /etc/nginx/nginx.conf
-c <path_to_config>:使用指定的配置文件而不是 conf 目錄下的 nginx.conf 。
- nginx啓動
sudo systemctl start nginx.service
- /重啓restart/停止stop 【nginx -s reload】
nginx -s reload
- nginx檢查配置【nginx -t】測試配置文件是否正確,在運行時需要重新加載配置的時候,此命令非常重要,用來檢測所修改的配置文件是否有語法錯誤。
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful