安装nginx
下载http://nginx.org/en/download.html,解压到XXX目录
将Nginx设置为Windows服务
借助winsw工具完成
1、下载Windows Service Wrapper
官网地址:
https://github.com/kohsuke/winsw/
下载地址:
http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/
2、将"winsw-xxx-bin.exe"重命名为"nginx-service.exe",并且复制到nginx根目录
在nginx根目录创建nginx-service.xml文件, 内容如下:
<service>
<id>nginx</id>
<name>nginx</name>
<description>nginx</description>
<logpath>E:\nginx-1.14.1\</logpath>
<logmode>roll</logmode>
<depend></depend>
<executable>E:\nginx-1.14.1\nginx.exe</executable>
<stopexecutable>E:\nginx-1.14.1\nginx.exe -s stop</stopexecutable>
</service>
cmd窗口运行 nginx-service.exe install
之后就可以在Windows服务面板中启动服务了