【发布时间】:2019-06-22 18:17:21
【问题描述】:
我尝试在管理员模式下运行以下命令将 nginx 安装为服务
nssm install ztestservice "C:\Stack\nginx\nginx.exe"
nssm 正在安装服务,但在注册表中没有引用应用程序路径。即没有设置任何参数。当我尝试启动服务时显示错误“无法启动服务”。
请帮忙。
【问题讨论】:
标签: windows windows-services nssm
我尝试在管理员模式下运行以下命令将 nginx 安装为服务
nssm install ztestservice "C:\Stack\nginx\nginx.exe"
nssm 正在安装服务,但在注册表中没有引用应用程序路径。即没有设置任何参数。当我尝试启动服务时显示错误“无法启动服务”。
请帮忙。
【问题讨论】:
标签: windows windows-services nssm
我一直在使用 nssm 来运行一个 php 脚本。我发现如果你只运行:
nssm install ztestservice
nssm 将弹出一个窗口,让您设置所有其他参数。否则,您可以使用 set 命令单独设置参数:
nssm set <servicename> <parameter> [<subparameter>] <value>
所以:
nssm set ztestservice AppParameters "C:\Stack\nginx\nginx.exe"
但是,请注意。在 Windows 2012r2 上,我遇到了一个问题,它现在挂在停止命令上,所以我要小心!
编辑:您还可以运行 nssm dump ztestservice' will also give you a list of the available parameters
EDIT2: (Will i ever stop editing this?)nssm edit ztestservice' 来编辑您刚刚创建的服务,更改所有参数并将它们设置在注册表中。
【讨论】: