在 Windows 下载安装了 Nginx,配置了环境变量全局使用 Nginx。但是仍旧无法开启nginx -t等命令。
Nginx 在使用时 conf-path 是根据相对路径来找的。 匹配的路径是 C:\Users\20210121/conf/nginx.conf ,完全是错的。
制作一个donginx.bat(命令根据名字而改变,比如这里命令开头用donginx, 如果bat名字为 aaa.bat, 则命令开头为 aaa )文件,将nginx改天换命。
@echo off
if "%1"=="help" (goto help) else (if "%1"=="-h" goto help)
if "%1"=="version" (goto version) else (if "%1"=="-v" goto version)
if "%1"=="start" goto start
if "%1"=="stop" goto stop
if "%1"=="reload" goto reloadmd
if "%1"=="reopen" goto reopen
if "%1"=="find" goto find
goto error
:help
nginx -v
echo Usage: donginx [-h,help] [-v,version] [start] [stop] [stop -a] [reload] [reopen] [find]
echoecho=
echo Options:
echo help,-h : this help
echo version,-v : show current nginx version
echo start : start nginx master process
echo stop : stop the newest nginx master process
echo stop -a : stop all nginx master processes
echo reload : reload configuration
echo reopen : reopen nginx
echo find : show the nginx master process list
echo=
exit /B
:version
nginx -v
exit /B
:start
start nginx -p C:\nginx-1.20.1
exit /B
:stop
if "%2"=="-a" (taskkill /F /IM nginx.exe) else (if "%2"=="" (nginx -s stop -p C:\nginx-1.20.1) else goto error)
exit /B
:reload
nginx -s reload -p C:\nginx-1.20.1
exit /B
:find
tasklist /fi "imagename eq nginx.exe"
exit /B
:error
echo donginx: invalid option: "%1 %2"
echo=
exit /B
donginx help,-h : this help
donginx version,-v : show current nginx version
donginx start : start nginx master process
donginx stop : stop the newest nginx master process
donginx stop -a : stop all nginx master processes
donginx reload : reload configuration
donginx reopen : reopen nginx
donginx find : show the nginx master process list
Network 灰鸽宝典为开发配置保驾护航,让服务运行快捷平稳。 希望某个知识点就能帮助你,欢迎学习GIS的朋友一起交流。
《 Openlayers 综合示例200+ 》,
《 leaflet示例教程100+ 》,
《 Cesium示例教程100+》,
《MapboxGL示例教程100+》。
阅读量:826
点赞量:0
收藏量:0