How to enable Node.js

Your domain must run on a private server (VPS) or Dedicated server running Ubuntu in order to enable Node.js.

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.

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. 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.

For example, if you have the following setup:

app directory: example.com/app.js
web directory: example.com/public

Passenger will automatically load the app.js file in the application directory. So if you visit example.com, it would load the app.js file.

Additionally, when you enable the checkbox, Passenger runs your Node.js files using the system version at:

[server]$ which node
/usr/bin/node

If you installed a custom version, Node.js automatically writes lines to your user's .bashrc file. Those lines change the version to your locally installed version. For example: 

[server]$ which node
/home/exampleuser/.nvm/versions/node/v6.10.0/bin/node

Enabling Node.js in the panel

To enable Node.js:

  1. Navigate to the (Panel > 'Domains' > 'Manage Domains') page.
  2. Click the Edit button to the right of your domain under the 'Web Hosting' column.
    The 'Manage Domains' settings page opens:
    01 RVM nodejs.fw.png
  3. Scroll down to the 'Web Options' section and check the 'Passenger (Ruby/NodeJS/Python apps only):' check box.
  4. 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.

  5. Click OK.
  6. Your 'Web directory' field automatically adds a /public folder to the end. The NodeJS check box also appears:
    03 RVM nodejs.fw.png
  7. Check the 'NodeJS:' check box to allow Node.js to use Passenger on your domain.

See also

Internal links

External links

Did this article answer your questions?

Article last updated .