Nginx-s reload-p <nginx Environment directory >-c < specified configuration file >
Where-p-c is optional, does not write as default path and configuration
Before executing the command, you can
Nginx-t-p<>-c<>
Check that the custom configuration file is correct
In addition nginx Stop command for
PS grep Nginx
Kill 30439<pid>
30439 for the example in the diagram, the PID of Nginx master process
Start the command again
Nginx-p<>-c<>
There's a pit for the reload command only support changes to the configuration file, does not support the change of files, such as the current running configuration file is nginx.conf, and then I modify this file and then reboot no problem
Nginx-s reload-c conf/nginx.conf
But if I want to switch to conf/nginx.other.conf,
Nginx-s reload-c conf/nginx.other.conf
This is not in effect, he still re-read the original file configuration
So if there are multiple profiles that need to be switched, my approach is to rename the configuration file and change the desired profile name to nginx.conf
MV nginx.other.conf nginx.conf
Actually, it's for the blue-green switch.
The switch script is as follows
Case$1 inchBlue)if[-F"Nginx.blue.conf.bak" ] Then MVnginx.conf Nginx.green.conf.bakMVNginx.blue.conf.bak nginx.conf Nginx-S Reload-p/weblogic/nginx-c conf/nginx.confEcho 'Switch to Blue' Else Echo 'configuration does not exist' fi ;; Green)if[-F"Nginx.green.conf.bak" ] Then MVnginx.conf Nginx.blue.conf.bakMVNginx.green.conf.bak nginx.conf Nginx-S Reload-p/weblogic/nginx-c conf/nginx.confEcho 'Switch to the Green Group' Else Echo 'configuration does not exist' fi ;;Esac
The Toggle command is
SH CBD. SH blue/green
Basic usage of Linux Nginx