Home > Operation and Maintenance > Linux Operation and Maintenance > How to shut down nginx in linux

How to shut down nginx in linux

WBOY
Release: 2022-08-23 17:31:28
Original
28262 people have browsed it

How to shut down nginx in Linux: 1. Use the "ps -ef | grep nginx" command to check the nginx process, and then use "kill -QUIT process number" to shut down nginx; 2. Use "kill -TERM. .." just kill the process quickly; 3. Use "pkill -9 nginx" to forcefully stop the process.

How to shut down nginx in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to shut down nginx in Linux

Startup code format: nginx installation directory address -c nginx configuration file address For example:

[root@ettest app]# /usr/sbin/nginx -c /etc/nginx/nginx.conf
Copy after login

There are three ways to stop :

First type:

1. View the process command as follows:

[root@ettest app]# ps -ef | grep nginx
Copy after login

How to shut down nginx in linux

2. Kill the process: kill -QUIT process number

[root@ettest app]# kill -QUIT 36398
Copy after login

Second: Kill the process quickly

[root@ettest app]# kill -TERM 2132
或 [root@ettest app]# kill -INT 2132
Copy after login

Third: Forced stop :

[root@ettest app]# pkill -9 nginx
Copy after login

How to restart:

Enter the nginx executable directory sbin and enter the command **./nginx -s reload** can

How to verify the configuration file:

Enter the nginx installation directory sbin and enter the command ./nginx -t

See nginx.conf syntax is ok

nginx.conf test is successful
Copy after login

Indicates that the configuration file is correct

Extended knowledge

linux Next start nginx and close nginx, check linux open All ports netstat -ntpl, restart the service command: service network restart

1. Enter the installation directory whereis nginx

2. Enter the path: cd /usr/local/nginx/sbin

3. Start nginx command: ./nginx If the following appears, the startup is successful

4. Check the status of nginx ps -ef | grep nginx If master appears, the startup is successful

How to shut down nginx in linux

5. Close nginx command kill -9 process number, then close nginx

6. Stop nginx command: ./nginx -s stop

7. Restart nginx command :./nginx -s reload

Recommended learning: Linux video tutorial

The above is the detailed content of How to shut down nginx in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template