Summary of nginx restart command methods (linux, centos, ubuntu)

Source: Internet
Author: User
Tags goto centos nginx server

Smooth restart

If the Nginx server is running and the module needs to be upgraded, added, or deleted, we need to stop the server and modify it accordingly, so that the server will stop service for a period of time, nginx can be upgraded without stopping services.

Smooth restart command:
Kill-HUP enters the title or process number file path
Or use

/Usr/nginx/sbin/nginx-s reload

Note: after modifying the configuration file, check whether the modified configuration file is correct to avoid Nginx errors affecting the stable running of the server. The command to determine whether the Nginx configuration is correct is as follows:
Nginx-t-c/usr/nginx/conf/nginx. conf
Or

/Usr/nginx/sbin/nginx-t

Nginx reload restart

Run

#/Usr/local/nginx/sbin/nginx-s reload
Nginx has been restarted successfully

Restart with root permission

# Killall nginx

# Nginx

Linux restart

Sudo/etc/init. d/nginx Usage:
/Etc/init. d/nginx {start | stop | status | restart | condrestart | try-restart | reload | force-reload | configtest}


(Windows nginx)

@ Echo off
Role of rem current bat
 
Echo ============================ begin ============================= ====
 
Cls
SET NGINX_PATH = D:
SET NGINX_DIR = D: \ nginx \
Color 0a
TITLE Nginx hypervisor www.111cn.net control panel
 
CLS
 
ECHO.
ECHO. * Nginx hypervisor *
ECHO. * create 2013-10-15 *
ECHO.
 
: MENU
 
ECHO. * nginx process list *
Tasklist | findstr/I "nginx.exe"
 
ECHO.
ECHO. [1] start Nginx
ECHO. [2] disable Nginx
ECHO. [3] restart Nginx
ECHO. [4] return
ECHO.
 
ECHO. Enter the serial number of the selected project:
Set/p ID =
IF "% id %" = "1" GOTO start
IF "% id %" = "2" GOTO stop
IF "% id %" = "3" GOTO restart
IF "% id %" = "4" EXIT
PAUSE
 
: Start
Call: startNginx
GOTO MENU
 
: Stop
Call: shutdownNginx
GOTO MENU
 
: Restart
Call: shutdownNginx
Call: startNginx
GOTO MENU
 
: ShutdownNginx
ECHO.
ECHO. Disable Nginx ......
Taskkill/F/IM nginx.exe> nul
ECHO. OK, close all nginx processes
Goto: eof
 
: StartNginx
ECHO.
ECHO. Start Nginx ......
If not exist "%nginx_dir1_nginx.exe" ECHO "%nginx_dir1_nginx.exe" does NOT EXIST
 
% NGINX_PATH %
 
Cd "% NGINX_DIR %"
 
If exist "%nginx_dir1_nginx.exe "(
Echo "start ''nginx.exe"
Start "" nginx.exe
)
ECHO. OK
Goto: eof

Centos nginx restart

Restart Nginx

Service nginx restart
/Etc/init. d/nginx stop
/Etc/init. d/nginx start

Ubuntu Nginx

$ Sudo service nginx start
$ Sudo service nginx stop

Well, I have summarized the methods for restarting the nginx system in almost all systems. Each system may be slightly different. If you are interested, please refer to them.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.