User

Deploying a Node.js App

Step-by-step guide to deploying a Node.js application in Opterius Panel.

Last updated 1775606400

Before You Start

  1. Your Node.js app files must already be on the server — upload them via FTP, SSH, or the File Manager
  2. Your app must listen on a port (use process.env.PORT — the panel passes it automatically)
  3. Run npm install inside your app directory before deploying

Step 1 — Prepare Your App

Make sure your app reads the port from the environment:

// server.js
const express = require('express');
const app = express();

const PORT = process.env.PORT || 3000;

app.get('/', (req, res) => res.send('Hello from Opterius!'));

app.listen(PORT, () => console.log(`Listening on port ${PORT}`));

Step 2 — Install Dependencies

SSH into your server (or use the Web Terminal) and run:

cd /home/myuser/mydomain.com
npm install --production

Step 3 — Deploy in the Panel

  1. Go to Node.js in the sidebar
  2. Click Deploy App
  3. Fill in the form:
    • Domain — the domain Nginx should proxy to your app
    • App Name — a short identifier (e.g. api or myapp). Used as the PM2 process name.
    • Startup Command — the command to start your app (e.g. node server.js or npm start)
    • Port — the port your app listens on (e.g. 3000)
  4. Click Deploy App

The panel will:

  • Start your app with PM2 under your account user
  • Configure Nginx to proxy your domain to the specified port
  • Redirect all HTTP traffic to HTTPS

Startup Commands

App type Startup command
Plain Node.js node server.js
npm start script npm start
Express (direct) node index.js
Next.js npm run start
Fastify node app.js

Checking the App Is Running

After deploying, visit your domain. If the page doesn't load:

  1. Go to Node.js → your app → Logs — check for startup errors
  2. Verify npm install was run in the working directory
  3. Make sure your app actually listens on the port it was given

Re-deploying After Code Changes

The panel does not auto-deploy on file changes. After updating your app files:

  1. Go to Node.js → your app
  2. Click Restart

Or via SSH:

pm2 restart myuser_myapp

Next Steps