Node.js is a cross-platform, open-source JavaScript runtime environment that executes JavaScript code outside a web browser. It is built on Chrome's V8 engine and is designed for building scalable network applications. When you choose a Node.js optimized VPS from HostGraber, your stack—including Node.js, NPM, and PM2—is pre-configured and ready for deployment.

This guide will help you verify that your runtime, process manager, and reverse proxy are working in harmony.


1. Access Your Server and Retrieve Credentials

To begin, log in to your server via SSH using your server IP and the deploy user credentials provided in your HostGraber Welcome Email.

Note: For security, direct root login is often disabled. Log in as deploy and use sudo for administrative tasks.

View your specific application details:

 
cat /root/credential.txt

Take note of the App Port (3000), App Directory, and PM2 App Name.


2. Check Node.js and NPM Versions

Verify that the runtime and package manager are correctly installed and accessible.

Commands:

 
node -v
npm -v
  • What to look for: You should see version numbers (e.g., v24.15.0). This confirms the binaries are in your system PATH.


3. Verify Your Application with PM2

HostGraber uses PM2 to keep your Node.js application running 24/7 and to restart it automatically if it crashes.

Check the status of your app:

 
pm2 status
  • What to look for: Look for your app name (default: nodeapp) in the list. The status should be online.

  • View real-time logs: pm2 logs nodeapp


4. Check the Nginx Reverse Proxy

In a production environment, Nginx sits in front of Node.js to handle web traffic (Port 80) and forward it to your app (Port 3000).

Check Nginx status:

 
systemctl status nginx

Verify Nginx is listening:

 
ss -tulnp | grep :80
  • Expected Result: You should see Nginx listening on port 80. This ensures your App URL (http://your_ip) will correctly load your Node.js application.


5. Test the Application Locally

You can test if the Node.js process is responding on its internal port before checking through the web browser.

Command:

 
curl -I http://localhost:3000
  • Expected Output: A HTTP/1.1 200 OK or similar response from your application.


Troubleshooting Tips

  • App is "errored" in PM2: Run pm2 logs nodeapp to see the specific JavaScript error causing the crash.

  • Permission Denied: Ensure you are working within the /home/deploy/app/ directory, which is owned by the deploy user.

  • Firewall Issues: Use sudo ufw status to ensure ports 80, 443, and 3000 are allowed.

For expert assistance with your Node.js deployments, visit our documentation at HostGraber.com.


Summary Checklist

Component Verification Command
Node.js node -v
Process Manager pm2 status
Web Server systemctl status nginx
App Logs pm2 logs nodeapp

 

 

Running a high-traffic API? Explore our High-Performance Node.js VPS plans.

Was this answer helpful? 0 Users Found This Useful (0 Votes)