Home  >  Article  >  Operation and Maintenance  >  What is the nginx restart command under linux?

What is the nginx restart command under linux?

青灯夜游
青灯夜游Original
2020-08-24 11:05:3443217browse

The nginx restart command under Linux is: "kill -HUP nginx process number". Restart method: First find the current nginx process number, and then enter the command "kill -HUP process number" to restart the nginx service.

What is the nginx restart command under linux?

Startup

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

For example:

[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

Stop

There are three ways to stop nginx:

  • Stop calmly

## 1. Check the process number

[root@LinuxServer ~]# ps -ef|grep nginx

 2. Kill the process

[root@LinuxServer ~]# kill -QUIT 2072

  • Quick stop

1. Check the process number

[root@LinuxServer ~]# ps -ef|grep nginx

2. Kill the process

[root@LinuxServer ~]# kill -TERM 2132
或 [root@LinuxServer ~]# kill -INT 2132

  • Force stop

[root@LinuxServer ~]# pkill -9 nginx
Restart

1. Verify whether the nginx configuration file is correct

Method 1: Enter the nginx installation directory sbin, Enter the command ./nginx -t

and see the following display: nginx.conf syntax is ok

nginx.conf test is successful

, indicating that the configuration file is correct!

Method 2: Add -t before the startup command -c

2. Restart the Nginx service

Method 1: Enter the nginx executable directory sbin and enter the command

./nginx -s reload

Method 2: Find the current nginx process number, and then enter the command: kill -HUP process number to restart the nginx service

##Related recommendations: "

Linux Operation and Maintenance

"

The above is the detailed content of What is the nginx restart command under linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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