網站首頁 編程語言 正文
前言:在使用LeafLet寫離線地圖時,需要將Nginx作為LeafLet的代理,實現內網訪問外網地圖瓦片,下面是將Nginx添加為Windows服務。
1、下載安裝Nginx
官網:http://nginx.org/en/download.html
注意:我是將Nginx安裝到了D盤,所以后面的文件修改時注意自己的路徑問題。
2、添加服務
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
3、安裝Nginx為Windows服務
進入Nginx的安裝路徑
D:\nginx-1.18.0 >nginx-service.exe install
4、啟動Nginx服務
控制面板–>管理工具–>服務–>找到Nginx Service 1.8.0服務–>啟動
現在已經將Nginx添加為Windows服務了,可以自行測試。需要源文件的小伙伴可以私信我呀~
原文鏈接:https://blog.csdn.net/qq_45701130/article/details/122980051
相關推薦
- 2022-07-13 rsync下行同步+inotify實時同步部署
- 2023-07-15 oracle 序列/自增ID
- 2022-07-01 python神經網絡Pytorch中Tensorboard函數使用_python
- 2022-06-20 基于python?的Pygame最小開發框架_python
- 2022-11-05 Nginx配置文件中location配置的多種場景_nginx
- 2022-10-23 C#泛型集合類型實現添加和遍歷_C#教程
- 2022-05-12 Android Studio 崩潰一閃而過抓不到日志
- 2022-10-02 React構建組件的幾種方式及區別_React
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支