服务程序拷到对应程序的目录下
    服务程序改成对应的名称:nginx-service.exe
    新建nginx-service.exe.xml

    1. <?xml version="1.0" encoding="UTF-8" ?>
    2. <configuration>
    3. <startup>
    4. <supportedRuntime version="v2.0.50727" />
    5. <supportedRuntime version="v4.0" />
    6. </startup>
    7. <runtime>
    8. <generatePublisherEvidence enabled="false" />
    9. </runtime>
    10. </configuration>

    新建nginx-service.xml

    1. <?xml version="1.0" encoding="UTF-8" ?>
    2. <service>
    3. <id>nginx</id>
    4. <name>nginx</name>
    5. <description>High Performance Nginx Service</description>
    6. <logpath>C:\Gx\GxTool\nginx_1.14.1\logs</logpath>
    7. <log mode="roll-by-size">
    8. <sizeThreshold>10240</sizeThreshold>
    9. <keepFiles>8</keepFiles>
    10. </log>
    11. <executable>C:\Gx\GxTool\nginx_1.14.1\nginx.exe</executable>
    12. <startarguments>-p C:\Gx\GxTool\nginx_1.14.1</startarguments>
    13. <stopexecutable>C:\Gx\GxTool\nginx_1.14.1\nginx.exe</stopexecutable>
    14. <stoparguments>-p C:\Gx\GxTool\nginx_1.14.1 -s stop</stoparguments>
    15. </service>

    最后形成的应该是这样的结构。
    image.png
    最后执行命令进行注册

    1. nginx-service.exe install