方式1
#!/usr/bin/env bashNGINX_PID_FILE=/var/run/nginx.pidif [ -f "/custom-env-and-nginx-init.sh" ]
thensource /custom-env-and-nginx-init.sh
fistop_nginx() {echo "Stopping nginx..."PID=$(cat "$NGINX_PID_FILE")/bin/kill -s TERM $PIDexit
}trap stop_nginx INT TERM
/usr/sbin/nginx -g "daemon off;" &
NGINX_PID=$!
wait "$NGINX_PID"#!/usr/bin/env bashNGINX_PID_FILE=/var/run/nginx.pidif [ -f "/custom-env-and-nginx-init.sh" ]
thensource /custom-env-and-nginx-init.sh
fistop_nginx() {echo "Stopping nginx..."PID=$(cat "$NGINX_PID_FILE")/bin/kill -s TERM $PIDexit
}trap stop_nginx INT TERM/usr/sbin/nginx -g "daemon off;" &wait 方式2
#!/usr/bin/env bashNGINX_PID_FILE=/var/run/nginx.pidif [ -f "/custom-env-and-nginx-init.sh" ]
thensource /custom-env-and-nginx-init.sh
fistop_nginx() {echo "Stopping nginx..."PID=$(cat "$NGINX_PID_FILE")/bin/kill -s TERM $PIDexit
}trap stop_nginx INT TERM
exec /usr/sbin/nginx -g "daemon off;"
![CoreSecurityCommon-1076131302-260526-2112-16 conv 1]()
![CoreSecurityCommon-1076131302-260526-2112-16 conv 2]()
![CoreSecurityCommon-1076131302-260526-2112-16 conv 3]()
![CoreSecurityCommon-1076131302-260526-2112-16 conv 4]()
![CoreSecurityCommon-1076131302-260526-2112-16 conv 5]()
![CoreSecurityCommon-1076131302-260526-2112-16 conv 6]()
![CoreSecurityCommon-1076131302-260526-2112-16 conv 7]()
![CoreSecurityCommon-1076131302-260526-2112-16 conv 8]()