服务器建设一个自己的网站,看男科花了一万多了,烟台网站建设 共赢,中国机械加工网最新订单window-nginx注册服务(nginx-1.24.0.zip) 1、下载当前windows版nginx的稳定版本。 https://nginx.org/en/download.html 2、解压到指定目录中#xff0c;这里解压到D盘根目录#xff0c;D:\nginx-1.24.0 3、管理员打开命令行#xff0c;可先进行相关操作#xff0c;看一下n…window-nginx注册服务(nginx-1.24.0.zip) 1、下载当前windows版nginx的稳定版本。 https://nginx.org/en/download.html 2、解压到指定目录中这里解压到D盘根目录D:\nginx-1.24.0 3、管理员打开命令行可先进行相关操作看一下nginx是否能够正常启动 # 修改配置文件后可以检测配置文件语法是否有错误
nginx.exe -t
# 命令启动nginx
start nginx.exe
# 重新加载配置文件
nginx -s reload
# 关闭nginx
nginx -s stop4、下载WinSW(这里使用的是WinSW v2.12.0) 下载地址 https://github.com/winsw/winsw/releases 5、把下载的文件WinSW-x64.exe放到nginx根目录这里改名为nginx-service.exe。 同时创建一个同名的xml文件nginx-service.xml。 根据sample-minimal.xml和sample-allOptions.xml文件选择自己需要的参数。 serviceidnginx/idnamenginx/namedescriptionnginx server/descriptionlogpathD:\nginx-1.24.0\server-logs\/logpathlogmoderoll/logmodedepend/dependexecutableD:\nginx-1.24.0\nginx.exe/executable!-- 设置为false,即先关闭工作进程再关闭父进程不然会导致工作进程关不掉 --stopparentprocessfirstfalse/stopparentprocessfirststopexecutableD:\nginx-1.24.0\nginx.exe -s stop/stopexecutable
/service或者
serviceidnginx/idnamenginx/namedescriptionnginx server/descriptionlogpathD:\nginx-1.24.0\server-logs\/logpathlogmoderoll/logmodedepend/dependexecutableD:\nginx-1.24.0\nginx.exe/executablestopparentprocessfirstfalse/stopparentprocessfirststopexecutableD:\nginx-1.24.0\nginx.exe/stopexecutablestoparguments-s stop/stoparguments
/service6、注册服务 管理员运行cmd,根据帮助提示完成nginx服务的注册。 # 注册服务
nginx-service.exe install
# 卸载服务
nginx-service.exe uninstall
# 启动服务
net start nginx
nginx-service.exe start
# 停止服务
net stop nginx
nginx-service.exe stop7、使用命令和服务控制台测试服务的启动、停止、重新启动是否正常。 # net命令
net start nginx
net stop nginx# WinSW命令
nginx-service.exe start
nginx-service.exe restart
nginx-service.exe stop# 服务控制台控制服务的start、restart、stop小尾巴~~ 只要有积累就会有进步