Perhaps the statement of the problem is wrong. It is like this: there is a server in Alibaba Cloud now. The environment is apache plus mysql plus php, but I didn’t use php. I installed nodejs and wrote something. The listen3000 port can also be used.
However, nodejs app.js must be executed once for each access, and this 3000 port can only be accessed.
What can be done to be accessible at any time like HyperText Transport Protocol without executing any statement? Or just enter: address: 3000 and you can access it all the time. how?
Looking for many places, nodejs’s explanation is tohttp://localhost: 8,000 will not be mentioned. It is useless to rerun httpd on linux’s modified port, and it is not easy to change what Alibaba Cloud server has aliyundun. .
Ask for advice
To execute nodepap.js, you should start the nodepap.js service and let it listen to port 3000.
It needs to be executed every time because you don’t have the node process running all the time.
One of the easiest ways is to start using nohup:
nohup node app.js &
You can also run it in screen.
You can also use supervise or forever.
Simply, it is recommended to try forever. Look at this:https://cnodejs.org/topic/5021c2cff767cc9a51e684e3