Previously, it has been developed locally, directly entering the directory where the program is located, and then node server.js can run. now I have a server directory
This way I can access my main program file, but how do I start it?
You can also execute nodeserver.js on the server.
However, executing on the server can properly cut to the background inside:
nohup node server.js > myLog.log 2>&1 & //这句代替node server.js
In this way, your program will be cut to the background for execution, and a myLog.log and log will be generated. Relevant errors will also be recorded in the log.
Of course, there are some advanced tools like pm2 that will be more convenient. . . . But the general purpose is to make your program run in the background on the server side.