forked from liweijie/education
23 lines
498 B
Batchfile
23 lines
498 B
Batchfile
@echo off
|
|
setlocal
|
|
set NGINX_HOME=D:\nginx
|
|
set CONF=%~dp0nginx.conf
|
|
|
|
cd /d "%NGINX_HOME%"
|
|
nginx -p "%NGINX_HOME%/" -c "%CONF%" -t
|
|
if errorlevel 1 (
|
|
echo Nginx config test failed.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
tasklist /FI "IMAGENAME eq nginx.exe" | find /I "nginx.exe" >nul
|
|
if errorlevel 1 (
|
|
start "" "%NGINX_HOME%\nginx.exe" -p "%NGINX_HOME%/" -c "%CONF%"
|
|
echo Nginx started on port 80.
|
|
) else (
|
|
"%NGINX_HOME%\nginx.exe" -p "%NGINX_HOME%/" -c "%CONF%" -s reload
|
|
echo Nginx reloaded.
|
|
)
|
|
endlocal
|