On Linux, you can easily deploy NODEJS applications using forever or PM2. But under Windows it was a hassle, and PM2 clearly said that support for Linux & Macos,forever looks like a lot of problems in Windows:
There is also a choice is iisnode, this has the time to study, today first the more simple NSSM. NSSM will monitor the node service you installed, and if node is dead, NSSM will restart it automatically.
Installation use
Currently the latest version is 2.23 (), unzip after download, according to your system select 32-bit and 64-bit version, directly in the nssm.exe
directory Run command line, enter nssm install
+ your service name, for example:
- NSSM Install test
The GUI interface is then displayed:
In the Path
Select your installed Node.exe, Startup directory
Select your node app's directory, Argument
enter your startup file, such as run on my desktop index.js
(in the Startup directory directory execution node index.js
):
Click Install Service:
Then run:
- NSSM Start test
The service has started, I just index.js
started an HTTP server with the file, listening on port 3000 and can now open 127.0.0.1:3000
access:
Other settings can refer to the official documentation. Its command-line operation is also simple:
- NSSM Start <servicename>
- NSSM Stop <servicename>
- NSSM Restart <servicename>
Specific operation of the official documents are described in detail, no longer repeat.
At present, an intranet small project using the Nodejs, to find the System group application server and deployment is more troublesome (previously no node project), on a Windows server on its own use of NSSM simple deployment, the specific performance of the study.
Source: http://my.oschina.net/u/1582119/blog/316069
Deploying Nodejs on a Windows server using NSSM