nginx daemon reload code example

Example 1: how to start nginx in linux

sudo systemctl restart nginx

Example 2: nginx reload on windows

nginx -s stop	#fast shutdown
nginx -s quit	#graceful shutdown
nginx -s reload	#changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
nginx -s reopen	#re-opening log files

Example 3: systemctl nginx

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Tags:

Misc Example