<service>
    <id>nginx</id>
    <name>Nginx Service</name>
    <description>High Performance Nginx Web Server</description>
    <executable>D:\nginx\nginx.exe</executable>
    <startarguments>-p D:\nginx</startarguments>
    <stopexecutable>D:\nginx\nginx.exe</stopexecutable>
    <stoparguments>-s quit</stoparguments> <!-- 使用 -s quit 优雅关闭 -->
    <logpath>D:\nginx\logs</logpath>
    <log mode="roll-by-size">
        <sizeThreshold>10240</sizeThreshold> <!-- 10MB 日志滚动 -->
        <keepFiles>8</keepFiles>
    </log>
    <onfailure action="restart" delay="5 sec"/>
    <onfailure action="restart" delay="20 sec" when="2"/>
    <startmode>Automatic</startmode>
</service>