Plesk

Run a Node.js application in Plesk

Enable Node.js for a domain in Plesk, set the application root and startup file, install npm packages, add environment variables and restart the app.

IntermediatePlesk2 min read

Plesk can run Node.js applications such as Express APIs or a Next.js site next to normal PHP websites. The Node.js extension uses Phusion Passenger to start your app, restart it when needed and proxy requests from the domain to it. This guide shows the setup for a typical app.

Before you start

  • The Node.js extension and at least one Node.js version are installed (administrators: Extensions → Extensions Catalog → Node.js, and versions under Tools & Settings → Updates → Add/Remove Components).
  • Your app code uploaded via Git, FTP or the File Manager. Do not upload node_modules; install it on the server.
  • Your app must listen on the port Passenger provides, usually by reading process.env.PORT.

Enable Node.js for the domain

  1. Go to Websites & Domains and click Node.js under the domain.
  2. Click Enable Node.js.
  3. Set the fields:
    • Node.js Version – choose the current LTS version your app supports.
    • Package Manager – npm or Yarn.
    • Document Root – the folder with static files, for example /httpdocs/public. Passenger needs this to be a subfolder of the application root.
    • Application Mode – production.
    • Application Root – the folder that contains package.json, for example /httpdocs.
    • Application Startup File – for example app.js or server.js.

Install dependencies

Click NPM install (or Yarn install). Plesk reads package.json and installs packages into the application root. For build steps, click Run script and enter the script name, for example build.

Add environment variables

Click Custom environment variables → Specify and add values such as DATABASE_URL or NODE_ENV. They are passed to the app on start, which keeps secrets out of your repository.

Start and restart

Click Restart App after any code or variable change. Passenger starts the app on the first request, so the first page load may take a moment.

Example startup file

const app = require('express')(); app.get('/', (q, r) => r.send('OK')); app.listen(process.env.PORT || 3000);

Next.js and other frameworks

For Next.js, run build through Run script, then use a small startup file that starts Next's production server with the PORT variable. Frameworks that build static files only (for example Vite or Astro in static mode) do not need Node.js at runtime – upload the built dist folder as a normal site instead.

Troubleshooting

  • Web application could not be started (Passenger error page): click the error details or check Logs. A missing module means NPM install did not run; a syntax error points to the file and line.
  • 502 or blank page: the app listens on a fixed port instead of process.env.PORT.
  • Static files return 404: the document root does not match your static folder.
  • Old code still running: click Restart App; Passenger keeps processes alive between requests.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.