has been developed locally, directly into the directory of the program, and then node Server.js can run, and now I have a server directory
http://bukemall.com/gaoqiang/...
This gives you access to my main program file, but how do I start it?
Reply content:
has been developed locally, directly into the directory of the program, and then node Server.js can run, and now I have a server directory
http://bukemall.com/gaoqiang/...
This gives you access to my main program file, but how do I start it?
You can also execute node server.js on the server;
However, execution on the server can be properly cut into the background:
Nohup node server.js > MyLog.log 2>&1 &//This sentence instead of node server.js
This way your program will be cut into the background to execute, and generate a myLog.log and logs, related errors will be recorded in the log;
Of course, there are some advanced tools like PM2 that would be more convenient .... But the general purpose is the same so that your program on the server can be run in the background;
Google PM2
When the server enters the directory where the program is located, then node server.js you can.
Locally developed computers can also be viewed as a server
The same node server.js , only to be able to be accessed in the server needs to configure the port, if the 80 port is not occupied then the direct use of 80, if it is occupied with the other port. If you already have nginx then do a two-level domain name reverse. If you access directly with a different port to open the firewall allows access. In order to restart the server can also automatically restart node, you can use the PM2 mentioned above
Xie invited, only to see that the weekend is finished.
Look at your source,
I don't know what you are doing with this chatserver. It feels like an example of a websocket test used to do im chat.
You start with node Server.js only if you enter into your directory, and if not, add node xxx/server.js to the front.
XXX indicates your directory
Personal suggestion development using supervisor can listen to code, automatic restart, print log error, very suitable for development debugging
Refer to GitHub Https://github.com/petruisfan ...
After installation, Supervisor--debug Server.js is started.