Nginx启动关闭脚本(bat文件)

打开

@echo off
set nginx_path=D:\nginx-1.12.2
echo nginxpath: %nginx_path%
cd %nginx_path%
echo "nginx is starting on port 80"
start nginx
cd %~dp0

关闭

@echo off
set nginx_path=D:\nginx-1.12.2
echo nginxpath: %nginx_path%
cd %nginx_path%
tasklist | findstr /i "nginx.exe"  
echo "nginx is running, stopping..." 
rem nginx -s stop 
TASKKILL /F /IM nginx.exe /T  
echo "stop ok" 
cd %~dp0

如果启动文件无法启动时,将文件放在Nginx目录下,在桌面创建快捷方式就可以了,原因目前还不知道为什么,懂的老哥可以评论回复一哈子

你可能感兴趣的:(Nginx启动关闭脚本(bat文件))