I can stop nginx server using nginx -s stop
or nginx -s quit
.
What is the difference?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityQuit is a graceful shutdown. Nginx finishes serving the open connections before shutdown
Stop is a quick shutdown where is terminates in between serving the connection
-s stop
and -s quit
isn't explained. It was necessary to additionally read the source code to confirm this answer is correct.
-s stop
terminates the nginx process immediately while -s quit
does a graceful shutdown.
SIGQUIT
causes nginx to break if it listens on Unix domain sockets. It will fail to clean up sockets, then immediately terminate on next invocation because it can't create sockets at paths which already exist.
SIGTERM
causes nginx to shut down into a consistent state from which it can start back up. The daemon removes any Unix domain sockets, leaves all caches in a usable state, and so forth.
You basically never want to use QUIT.
quit
option is documented as the way to do a graceful exit.