A simple command to restart nginx

  • 2020-05-06 12:12:00
  • OfStack

However, after studying the nginx help, we found that there is -s parameter to manage the nginx service:
# /usr/local/nginx/sbin/nginx -h
nginx version: nginx/0.7.63
Usage: nginx [-?hvVt] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file

So I execute
# /usr/local/nginx/sbin/nginx -s reload
nginx has been restarted successfully
USES root permission

#killall nginx

#nginx

other related commands:

1. Display nginx for id
#ps -aux | grep nginx

2. Results nginx master pid
#kill -HUP 635

3. Restart ngnix
#nginx

Related articles: