Nginx startup under Linux

start up

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

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

stop

There are three ways to stop nginx:

Stop gracefully:

1. View the process number

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

 

2. Kill the process

[root@LinuxServer ~]# kill -QUIT 2072

 

Quick stop:

1. View the process number

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

 

2. Kill the process

[root@LinuxServer ~]# kill -TERM 2132

or

[root@LinuxServer ~]# kill -INT 2132

 

Force stop:

[root@LinuxServer ~]# pkill -9 nginx

reboot

1. Verify that the nginx configuration file is correct

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

See that nginx.conf syntax is ok

nginx.conf test is successful

The configuration file is correct!

 

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

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

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

 

In the test server, use the command kill -INT 2022 to shut down the nginx service, and then in the sbin directory, enter the command ./nginx to restart.

 

Transfer: http://www.cnblogs.com/codingcloud/p/5095066.html

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326350067&siteId=291194637