This article describes enabling Node.js to work with Passenger using the DreamHost panel.
What servers can Node.js be installed onto?
Node.js can be installed onto Shared, VPS, and Dedicated Servers.
The version of Passenger running on DreamHost servers does not currently function with Node.js versions 14+.
Can Node.js be used without enabling it in the panel?
Yes. You can create a Node.js app and deploy it manually. However, this can be a lot of work, depending on the complexity of your application. Deploying your Node.js app with Passenger is much easier and recommended.
If you choose not to use Passenger, you must find a way to deploy your application manually.
What does enabling Node.js in the panel do?
When you enable Node.js in the panel, Passenger knows your website is set up to run a Node.js app and automatically deploys it using Passenger on ports 80 and 443. However, this will only function under these two circumstances:
- The file to load the application is named app.js and is in your site's app directory
- Your .htaccess file has been updated to point to your local version of Node.js
Passenger then loads the app.js file automatically when visiting your URL. In this case, you do not have to bind a port # to the URL or manually start the server. Your configuration would look like this:
app directory: example.com/app.js web directory: example.com/public
Passenger is only able to run the file named app.js. If you have a server.js file that is normally used with your Node.js app, it must be renamed for Passenger to run it.
Enabling Passenger for Node.js in the panel
To enable Passenger for Node.js:
- Navigate to the Manage Websites page.
- Click the Manage button to open the Domain Settings page, which allows you to adjust various settings for your site.
- Scroll down to the Additional Settings section and click the Modify button on the Web Options row.
- Enable Passenger by clicking the radio button on the right. The panel adds a /public subdirectory, and the Node JS row appears.
If you already have a /public directory in the current Web directory, clicking OK will only switch the 'Web directory' to this new /public folder. Nothing in it is removed.
If you do not already have a /public directory, the panel creates it for you with a coming soon page. The files in your current Web directory remain untouched.
- Click the radio button on the Node JS row. When finished, click the Save Changes button to save your changes.