Node.js is an open-source, cross-platform JavaScript runtime environment, popular for various types of projects. It runs the V8 JavaScript engine, the core of Google Chrome, outside the browser, which makes Node.js highly performant.
To deploy a Node.js application on your cPanel account (Node.js hosting), the ‘Setup Node.js App’ tool simplifies the installation process and helps you get acquainted with the environment.
Deploying Node.js on cPanel:
Log in to your cPanel account.
Click on the Setup Node.js App icon.
A new page will appear. Click on Create Application to add a new application.
Select your application’s preferences as needed:
- Node.js version: Specify the version for your application.
- Application mode: Choose between development or production mode.
- Application root: Define the path to the folder containing your project’s Node.js source files.
- Application URL: Indicate the domain where your Node.js project will be deployed.
- Application Startup file: Specify the startup file, which corresponds to the command `node filename`.
- Passenger log file: Set the log file that will be created by Phusion Passenger, the Node.js execution engine used in the hosting environment.
- Add Variable: Create environment variables.
Once your Node.js application is created, you will have access to advanced management options:
- Destroy and Save: These options allow you to delete the deployed application and save any changes made.
- Source: This command is crucial for accessing your working environment via SSH or Terminal.
- Stop App and Restart: Useful for stopping and restarting the application, such as after making modifications.
- Run npm Install: Install dependencies using npm.
- Add variable: Add and modify variables passed to the application.
If these parameters were not specified during setup, default configurations will apply.