Use scripts after installation

Blog.csdn.net/weixin_4457…

// Download from nginx.org/download/

Note the release date and version number, here is a recent download to use, Windows is zip package



After decompression



To run the script, you need to modify two places, the drive letter and the storage path



Finally, the BAT code

@echo off
remThe current role of BATecho ==================begin========================
 
cls
SET NGINX_PATH=C:
SET NGINX_DIR=C:\work\nginx1.19. 5\
color 0a
TITLE NginxManagement Program By Shek Chung-ho (2048.Top)CLS
 
ECHO.
ECHO. * * NginxManagement Program By Shek Chung-ho (2048.Top) *ECHO. * 2020- 11- 25Shi Zonghao (2048.Top) *ECHO.
 
:MENU
 
ECHO. * Nginx process list *tasklist|findstr /i "nginx.exe"
 
ECHO.
    ECHO.1] startNginx 
    ECHO.2To closeNginx 
    ECHO.3] restartNginx 
    ECHO.4] back outECHO.
 
ECHO. Please enter the serial number of the selected item: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.
    ECHOClosed.Nginx. taskkill /F /IM nginx.exe > nul
    ECHO.OKClose all nginx processes goto :eof :startNginxECHO.
    ECHO. StartNginx.IF NOT EXIST "%NGINX_DIR%nginx.exe" ECHO "%NGINX_DIR%nginx.exe"There is no %NGINX_PATH%
 
    cd "%NGINX_DIR%"
 
    IF EXIST "%NGINX_DIR%nginx.exe" (
        echo "start '' nginx.exe"
        start "" nginx.exe
    )
    ECHO.OK
    goto :eof
Copy the code