将Ngnix做为Windows服务启动

1.将Nginx-Service解压到Nginx目录下

下载地址:https://download.csdn.net/download/ounumman/12667375

2.修改nginx-service.xml文件:

<service>
    <id>nginx</id>
    <name>nginx</name>
    <description>nginx</description>
    <logpath>D:\nginx\logs\</logpath>
    <logmode>roll</logmode>
    <depend></depend>
    <executable>D:\nginx\nginx.exe</executable>
    <stopexecutable>D:\nginx\nginx.exe -s stop</stopexecutable>
</service>
<!--  - name为服务名
 - logpath指定nginx日志文件地址
 - D:\nginx\nginx.exe为nginx可执行应用程序文件位置
 -->

3.管理员身份打开cmd,进入nginx目录,执行命令:

nginx-service.exe install         //安装系统服务
nginx-service.exe uninstall     //删除系统服务
nginx-service.exe stop           //停止系统服务
nginx-service.exe start          //启动系统服务

完整命令

D:\nginx>nginx-service.exe -h
A wrapper binary that can be used to host executables as Windows services
Available commands:
- 'install'   - install the service to Windows Service Controller
- 'uninstall' - uninstall the service
- 'start'     - start the service (must be installed before)
- 'stop'      - stop the service
- 'restart'   - restart the service
- 'restart!'  - self-restart (can be called from child processes)
- 'status'    - check the current status of the service
- 'test'      - check if the service can be started and then stopped
- 'version'   - print the version info
- 'help'      - print the help info (aliases: -h,--help,-?,/?)
Extra options:
- '/redirect' - redirect the wrapper's STDOUT and STDERR to the specified file
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风波天下

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值