Guide: How to Deploy Your First Node.js App on SVR4U
Welcome to SERVEFORU HOST INTEGRATED! Our infrastructure is built to support modern web applications. Follow this step-by-step guide to get your Node.js application live in minutes.
Step 1: Create the Application Environment
-
Log in to your cPanel account.
-
Scroll down to the Software section and click on Setup Node.js App.
-
Click the Create Application button.
-
Fill in the following details:
-
Node.js Version: Select your preferred version (we recommend the latest LTS).
-
Application Mode: Choose Production (Development is only for debugging).
-
Application Root: Enter the folder name where your code will live (e.g.,
my_app). -
Application URL: Select the domain and the path (leave the path blank to use the main domain).
-
Application Startup File: Usually
app.jsorindex.js.
-
-
Click Create.
Step 2: Upload Your Project Files
Now that the environment is ready, you need to add your code:
-
Go back to the cPanel home and open File Manager.
-
Navigate to the folder you named in the "Application Root" (e.g.,
/home/username/my_app). -
Upload your files. > Pro Tip: Do NOT upload the
node_modulesfolder. It is much faster to upload just yourpackage.jsonand let our server install the libraries for you.
Step 3: Install Dependencies (NPM Install)
-
Go back to Setup Node.js App and click the Edit (pencil icon) next to your app.
-
Scroll down to the Detected configuration files section.
-
If you uploaded a
package.json, you will see a button labeled Run NPM Install. Click it. -
Wait for the process to finish. This ensures all your libraries are installed correctly in our secure environment.
Step 4: Start and Test Your App
-
At the top of the interface, click Restart to ensure all changes are applied.
-
Click the Open button next to your Application URL.
-
Congratulations! Your Node.js app is now live on the SVR4U network.
???? Advanced: Using the Terminal
For developers who prefer the command line, cPanel provides a virtual environment command.
-
In the Setup Node.js App edit screen, you will see a command at the top starting with
source /home/.../bin/activate. -
Copy this command.
-
Open the Terminal in cPanel, paste the command, and hit enter.
-
You are now inside your Node.js environment and can run
npm,npx, ornodecommands directly!