EN
UAH

Simple Express-based Node.js server for ISPmanager hosting.

What’s included

Node.js Express A small Express app that:

  • listens on the port from the PORT environment variable (as required on shared hosting)
  • serves the main page and static content
  • exposes a /health endpoint
  • properly handles 404 and 500 errors

Ideal for rapid prototyping, testing, and lightweight landing pages or mini-apps

Project structure

my-express-app/
|-- package.json
|-- app.js
|-- .env (optional, for local development)
|-- public/
| `-- style.css
`-- views/
    `-- index.html

The public and views folders can be renamed; this is configurable in the code.

Create package.json


{
  "name": "my-express-app",
  "version": "1.0.0",
  "description": "Simple Express server for shared hosting (ISPmanager).",
  "main": "app.js",
  "scripts": {
    "start": "node app.js",
    "start:prod": "NODE_ENV=production node app.js"
  },
  "engines": {
    "node": ">=18.x"
  },
  "dependencies": {
    "express": "^4.19.2",
    "morgan": "^1.10.0"
  }
}


Notes:

scripts.start — the command you set in the panel to start the app. engines.node — indicates the desired Node.js version (you still select it manually in ISPmanager).

Create the server file app.js


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

const app = express();

// 1) Port: on shared hosting it’s set by the panel (PORT environment variable))
const PORT = process.env.PORT || 3000;

// 2) Request logging (useful for debugging)
app.use(morgan(process.env.NODE_ENV === 'production' ? 'combined' : 'dev'));

// 3) Serve static files from /public
app.use(express.static(path.join(__dirname, 'public')));

// 4) Home page (simple HTML from /views/index.html)
app.get('/', (req, res) => {
  res.sendFile(path.join(__dirname, 'views', 'index.html'));
});

// 5) Health check for monitoring
app.get('/health', (req, res) => {
  res.status(200).json({ status: 'ok', uptime: process.uptime() });
});

// 6) 404 — not found (no matching route)
app.use((req, res, next) => {
  res.status(404).send('404 Not Found');
});

// 7) 500 — basic error handler
app.use((err, req, res, next) => {
  console.error('Unhandled error:', err);
  res.status(500).send('500 Internal Server Error');
});

// 8) Start the server
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});
	

Simple homepage (views/index.html)


<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Express on shared hosting</title>
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link href="/style.css" rel="stylesheet" />
</head>
<body>
  <main>
    <h1>Express is running</h1>
    <p>A minimal Node.js (Express) server for shared hosting.</p>
    <ul>
      <li>Home: <code>/</code></li>
      <li>Health: <code>/health</code></li>
      <li>Static: <code>/public</code> (mounted at <code>/style.css</code>)</li>
    </ul>
  </main>
</body>
</html>

Node.js
Fast & Reliable Node.js Hosting
Start Your Project with Just a Few Clicks!
Free SSL CertificatPowered by Modern Servers7-Day Free Trial
View Plans

public/style.css — basic styles


html, body {
  margin: 0;
  padding: 0;
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}
main {
  max-width: 720px;
  margin: 12vh auto;
  padding: 24px;
  background: #111827;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
h1 { margin-top: 0; font-size: 28px; }
code { background: #1f2937; padding: 2px 6px; border-radius: 6px; }	

Optional: .env for running locally

In production the port is set by the panel; locally, do this:


PORT=3000
NODE_ENV=development

In ISPmanager, .env is usually not required. Make sure you don’t commit secrets.

Deploying to shared hosting in ISPmanager

  • Add a website/domain in ISPmanager (in the “WWW Domains” section).
  • Upload the project (via the file manager, Git, or SFTP) to the site root or app directory.
  • Install dependencies: open terminal/SSH, then run cd my-express-app and npm install.
  • Node.js application:
    • In the Node.js section, specify:
      • Node.js version (LTS/current)
      • Startup file: app.js
      • Start command (if required): npm start or just node app.js
      • Environment variables: the panel usually sets PORT automatically; if needed, set it manually (e.g., PORT=8080).
    • Attach the application to a domain/subdomain (the panel will automatically configure the web server to proxy to your process).
  • HTTPS: enable Let’s Encrypt in the domain settings
  • Restart: use the Restart button in the Node.js app (or restart via the control panel) after updates.

If the panel asks you to specify the port manually, set e.g. 8080, but your code should listen on process.env.PORT (the panel proxies to that port).

FAQ (Frequently Asked Questions)

On shared hosting, direct access to :port is typically disabled—traffic goes via Nginx/Apache on the domain. Use the domain instead of :port.
ISPmanager includes an application log viewer. Also, morgan logs to stdout, so you’ll see it in the process logs
Upload the changes > run npm install (if dependencies changed) > restart the process in the panel.

Quick pre-production checklist

The app listens on process.env.PORT
Static files are served from public/.
A /health endpoint is available for status checks.
Handles 404 and 500 errors.
HTTPS is enabled (Let’s Encrypt).

Contact details: Ukraine, 61202, Kharkiv, Ludviga Svobody st. 26-298.
FO-P Kharitinov Oleg Sergeevich
IBAN UA073052990000026001005905889
tax.number 2961615658
PrivatBank
mail:
Documentation:
Support service: телефон + 380 57 7209279
Create a ticket