On this page, we explain step by step how to setup a Nodejs App with CloudPanel.
When you Add the Domain, make sure to select the Nodejs Vhost Template.
By default, all requests are forwarded to port 3000 via reverse proxy.
If your Nodejs App is running under another port, you can change it easily in the Vhost Editor of your domain.
For running a NodeJs App in production it's recommended to use a process control system like supervisor, which restarts the node processes automatically in case of a failure.
- Install the supervisor package:
- Create a supervisor configuration file:
- Open the configuration file and put the following content:
Make sure that the user is correct to avoid permission problems.
- Update the configuration and start the node processes:
With the command supervisorctl you get information about the status, pid, and uptime:
You may want to see what happens in the background; you can do that by tailing the log file: