Plesk fully supports hosting Node.js applications alongside traditional PHP sites. You can easily manage PM2/Phusion Passenger deployments straight from the UI.
Enabling Node.js
- Go to Websites & Domains.
- Click on Node.js App.
- Click Enable Node.js for this domain.
Configuring the Environment
Once enabled, you'll need to configure how Plesk runs your app:
- Node.js Version: Select the version that your application was built for (e.g., 18.x or 20.x).
- Document Root: This is the public folder accessible by browsers (e.g., `/httpdocs/public`). Do not put your backend code inside the document root for security!
- Application Root: Where your actual application code (like `package.json` and `server.js`) lives. It should ideally be one folder above your Document Root (e.g., `/httpdocs`).
- Application Startup File: The entry point of your app, usually `app.js`, `server.js`, or `bin/www`.
Managing Packages and Running Apps
From the Node.js screen, you can click the NPM Install button to automatically download all packages listed in your `package.json` into a `node_modules` folder.
Whenever you make a change to your app code, click Restart App to kill the old process and launch the new compiled code!