Windows下nginx設置開機自啟動


第一步:下載 WinSW

https://github.com/winsw/winsw/releases/download/v2.10.3/WinSW.NET4.exe 64位系統

https://github.com/winsw/winsw/releases/download/v2.10.3/WinSW.NET2.exe 32位系統

第二步:配置步驟

  1. WinSW.NET4.exe 復制到 x:\xxxx\nginx\目錄中,修改文件名稱為 nginxservice.exe
  2. nginxservice.exe 同目錄中,新建一個空的 nginxservice.xml 文件(名字要與nginxservice.exe 名字前綴保持一致,但后綴是xml) ,nginxservice.xml 的內容:
<service>
    <id>nginx</id>
    <name>nginx</name>
    <description>nginx</description>
    <logpath>D:\nginx\nginx-1.18.0</logpath>
    <logmode>roll</logmode>
    <depend></depend>
    <executable>D:\nginx\nginx-1.18.0\nginx.exe</executable>
    <stopexecutable>D:\nginx\nginx-1.18.0\nginx.exe -s stop</stopexecutable>
</service>

完成后的文件目錄

  1. 管理員權限 打開 cmd

  1. 去服務里面啟動 nginx服務


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM