1.一键启动nginx
启动的时候只能启动当前目录的nginx.exe
@echo off
echo 正在启动nginx
cmd /c "start nginx.exe"
timeout /t 1 /nobreak > NUL
2.一键关闭nginx
关闭的时候只能关闭当前目录的nginx.exe
@echo off
echo 正在关闭nginx
cmd /c "nginx -s quit"
timeout /t 1 /nobreak > NUL
3.一建重启nginx
@ECHO OFF
chcp 65001
IF NOT EXIST "nginx.exe" (
ECHO "nginx.exe" 不存在,请联系管理员!
GOTO END
)else (
GOTO START
)
:START
:: 先关闭当前所有nginx服务
ECHO.
taskkill /F /IM nginx.exe > nul
ECHO.已关闭所有 nginx 进程
timeout /t 1 /nobreak > NUL
:: 启动nginx服务
start nginx.exe
ECHO.启动Nginx成功
GOTO END
:END
timeout /t 1 /nobreak > NUL
exit