2022-11-23 367
前言:在使用LeafLet写离线地图时,需要将Nginx作为LeafLet的代理,实现内网访问外网地图瓦片,下面是将Nginx添加为Windows服务。
官网:http://nginx.org/en/download.html
注意:我是将Nginx安装到了D盘,所以后面的文件修改时注意自己的路径问题。
nginx-service.xml、cmd-restart-nginx.bat、cmd-start-nginx.bat、cmd-stop-nginx.bat
nginx-service.xml内容:
<service>
<id>nginx180</id>
<name>Nginx Service 1.8.0</name>
<description>High Performance Nginx Service</description>
<logpath>D:\nginx-1.18.0\logs</logpath>
<log mode="roll-by-size">
<sizeThreshold>10240</sizeThreshold>
<keepFiles>8</keepFiles>
</log>
<!--
OPTION: stopparentprocessfirst
If set, WinSW will terminate the parent process before stopping the children.
Default value: false
-->
<stopparentprocessfirst>true</stopparentprocessfirst>
<executable>D:\nginx-1.18.0\nginx.exe</executable>
<startarguments>-p D:\nginx-1.18.0</startarguments>
<stopexecutable>D:\nginx-1.18.0\nginx.exe -s stop</stopexecutable>
<stoparguments>-p D:\nginx-1.18.0</stoparguments>
</service>
cmd-restart-nginx.bat内容:
cd D:\nginx-1.18.0
nginx-service.exe stop > nul
taskkill /f /t /im nginx.exe
nginx-service.exe start > nul
pause > nul
cmd-start-nginx.bat文件内容:
cd D:\nginx-1.18.0
nginx-service.exe start >nul
pause > nul
cmd-stop-nginx.bat文件内容:
cd D:\nginx-1.18.0
nginx-service.exe stop > nul
taskkill /f /t /im nginx.exe
pause > nul
进入Nginx的安装路径
D:\nginx-1.18.0 >nginx-service.exe install
控制面板–>管理工具–>服务–>找到Nginx Service 1.8.0服务–>启动
现在已经将Nginx添加为Windows服务了,可以自行测试。需要源文件的小伙伴可以私信我呀~
以上所述是小编给大家介绍的Windows中将Nginx添加为服务的问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!
原文链接:https://77isp.com/post/15835.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态