StarDomain

Running Node.js Apps in DirectAdmin

Running Node.js Apps in DirectAdmin

CloudLinux on our shared hosting servers supports Node.js applications. You can run Express, Next.js, Fastify, and other Node.js frameworks directly from your shared hosting account.

Prerequisites

  • A shared hosting plan with CloudLinux and Node.js support
  • SSH access enabled on your account (available on all plans)
  • Your Node.js application code ready to deploy

Setting Up a Node.js Application

Step 1: Access the Node.js Selector

  1. Log in to DirectAdmin
  2. Navigate to Extra Features or Advanced Features
  3. Click Setup Node.js App or Node.js Selector

Step 2: Create a New Application

  1. Click Create Application
  2. Configure the settings:

- Node.js version — Select from available versions (18.x, 20.x, etc.)

- Application mode — Production or Development

- Application root — The directory containing your app (e.g., /home/username/myapp)

- Application URL — The URL path (e.g., yourdomain.com or yourdomain.com/app)

- Application startup file — Usually app.js, server.js, or index.js

  1. Click Create

Step 3: Install Dependencies

After creating the app:

  1. Click Run NPM Install in the Node.js Selector interface
  2. Or connect via SSH and run:
bash
cd ~/myapp
npm install

Step 4: Start the Application

  1. In the Node.js Selector, click Start App or Restart
  2. Visit your domain to verify the app is running

Managing Your Node.js App

Starting and Stopping

  • Use the Start, Stop, and Restart buttons in the Node.js Selector
  • Or via SSH:
bash
cd ~/myapp
npm start

Viewing Logs

Application logs can be found at:

/home/username/myapp/stderr.log

Or check via SSH:

bash
tail -100 ~/myapp/stderr.log

Environment Variables

Set environment variables in the Node.js Selector interface or create a .env file in your application root.

Package Management

Installing Packages

Via SSH:

bash
cd ~/myapp
npm install express

Updating Packages

bash
cd ~/myapp
npm update

Tips for Node.js on Shared Hosting

  1. Use production mode — Set NODE_ENV=production for better performance
  2. Handle port configuration — The hosting environment assigns the port automatically; use process.env.PORT
  3. Keep dependencies minimal — Avoid unnecessary packages to stay within resource limits
  4. Use process managers wisely — The CloudLinux Node.js Selector handles process management for you
  5. Monitor resource usage — Node.js apps can consume significant memory; check your CloudLinux limits

Troubleshooting

Application Returns 503 Error

  • Check the application logs for errors
  • Verify the startup file path is correct
  • Ensure all dependencies are installed (npm install)
  • Restart the application

Module Not Found

  • Run npm install from the application root directory
  • Check that package.json lists the required module

Application Crashes on Start

  • Check stderr.log for error details
  • Ensure you are using a compatible Node.js version
  • Test your app locally before deploying

Need help? Contact our support team at {{SUPPORT_EMAIL}} or open a ticket at {{SUPPORT_URL}}.