Start the Linux environment, stop, restart nginx

Start
 startup code format: nginx installation directory address -c nginx profile address

E.g:

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

 

Stop
 nginx stops in three ways:

Stop calmly
  1 view process ID

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

 


 

 

  2, kill the process

[root@LinuxServer ~]# kill -QUIT 2072

 


 

 

Quick Stop
1, see the process ID

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

 


 

 

2, kill the process

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

 


 

 

Forced to stop
 

[root@LinuxServer ~]# pkill -9 nginx

 


 

 

Restart
1, nginx verify correct profile
method: the next installation nginx sbin directory, enter the command ./nginx -t
should see the following nginx.conf syntax is ok

nginx.conf test is successful

Description configuration file correctly!

 

 

 

Method 2: Start a command preceded by -t -c

 

 


 2, restart Nginx service
 Method One: Go under nginx executable directory sbin, you can enter the command ./nginx -s reload

 

 


Method Two: nginx find the current process ID, and then enter the command: kill -HUP process ID realize restart nginx service

 

Guess you like

Origin www.cnblogs.com/mr-wuxiansheng/p/12505454.html