Overview
Node.js is a JavaScript runtime environment used to develop server tools and applications. It uses JavaScript, traditionally a front end programming language on the server side.
This article describes how to enable 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 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 chose to not use Passenger, you would need to find a way to manually deploy your application.
What does the panel checkbox do?
When you enable the checkbox feature 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. You do not have to bind a port # to the URL or manually start the server in this case. 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 in order for Passenger to run it.
Enabling Passenger for Node.js in the panel
To enable Passenger for Node.js:
- Navigate to the Hosted Domains page.
- Click the Edit link to the right of your domain under the Web Hosting column.
- The Hosted Domains settings page opens:
- Scroll down to the Web Options section and check the Passenger (Ruby/NodeJS/Python apps only): check box.
- Checking this displays a pop-up warning.
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 OK.
- Your Web directory field automatically adds a /public folder to the end. The NodeJS check box also appears:
- Check the 'NodeJS:' check box to allow Node.js to use Passenger on your domain.