Use nssm to deploy windows service startup applications

Both swoole and workerman can implement the function of instant communication. Here I will simply take the example of starting workman as a windows server. Go straight to the topic:

Download this chat room project

workerman chat room http://www.workerman.net/workerman-chat

Click start_for_win.bat and a black window will appear. Browse http://127.0.0.1:55151 in the browser to see the chat room page! But when we close the black window, we will find that it exits when browsing port 55151! When the project is actually deployed, I think this is very insecure, so we have to find a way to implement the daemon process, run this bat file as a windows service, let's use nssm, and use nssm to convert bat into a service

Download the nssm software first, and you can directly search for one on Baidu!

 

 

After downloading, it is a compressed package. Unzip it and find the 32/64-bit nssm corresponding to your own system (find nssm under the path in the cmd window) and execute nssm install <service name> For example: nssm install workerman (custom service name)

Then press Enter to appear the configuration interface of nssm, fill in the bat file address in your project in the interface, for example:

Click install service, for example:

Note: 360 will intercept the service, just ignore it

When it shows successful, it means that the service has been installed successfully! We can click on My Computer-"Management-"Services to see if this service exists. As shown in the figure, I can already see the service named workerman:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324887543&siteId=291194637