windows安装nginx服务
1、nginx-service.exe 文件
https://repo.jenkins-ci.org/releases/com/sun/winsw/winsw 下载服务封装软件
nginx-service.exe由winsw重命名而来
2、nginx-service.exe.config文件
需要有.NET Framework的运行库,C:\Windows\Microsoft.NET\Framework查看运行库版本
<configuration>
<startup>
<supportedRuntime version="v2.0.50727" />
<supportedRuntime version="v4.0" />
</startup>
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
</configuration>
3、nginx-service.xml文件
<service>
<id>nginx</id>
<name>Nginx Service</name>
<description>High Performance Nginx Service</description>
<logpath>D:\software\nginx\install\nginx-1.20.1\logs</logpath>
<log mode="roll-by-size">
<sizeThreshold>10240</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<executable>D:\software\nginx\install\nginx-1.20.1\nginx.exe</executable>
<startarguments>-p D:\software\nginx\install\nginx-1.20.1</startarguments>
<stopexecutable>D:\software\nginx\install\nginx-1.20.1\nginx.exe</stopexecutable>
<stoparguments>-p D:\software\nginx\install\nginx-1.20.1 -s stop</stoparguments>
</service>
需要注意安装的位置启动端口
4、指令
安装:nginx-service.exe install
启动:net start nginx
停止:net stop nginx
删除:sc delete nginx(先停后删)
4、nginx
server {
keepalive_requests 100;
listen 80;
#listen 443 ssl;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://dev.mypro.org:8089/;
proxy_read_timeout 350;
}
location /myres {
alias D:/software/idea/workspace/pro/src/main/resources/static;
}
}
https://nginx.org/en/download.html 下载