Run a program as a service in Windows
This tutorial is based on Windows 8.1 + NSSM 2.21.1 but should work with other versions as well.
Setup
- Download NSSM (the Non-Sucking Service Manager)
- Open the archive and extract the
win32
orwin64
directory (depending on your Windows installation’s architecture, you can check this by pressing Windows Key + Pause) Note: As there is no installer, you should extract the file to a safe location, for exampleC:\Program Files\NSSM
- Open a command window with administrator privileges
- Open start
- Type
cmd
- Right-click on
cmd
and chooseRun as administrator
- Navigate to your NSSM directory, for example:
cd "C:\Program Files\NSSM"
- Type
nssm install
and press enter - Select the program to run as a service by clicking
...
afterPath
- Give the service a name (
Service name
) - Click
Install service
You’re done. You’ve installed a normal program as a service. It’s possible to define more settings, but these are the minimal settings required.
Note: if you’re coming from Install nginx and PHP on Windows, use -b 127.0.0.1:9000
in the Options
field.
Managing services
- Open start
- Type
services.msc
and press enter - Search for your service
- Right-click your service to manage it (start, stop, restart etc)
Leave a comment