DreamHost supports Node.js, but not on every plan. Before you buy, check which plan you need, because a Node.js app won't run on its shared hosting.

This article answers that question and then walks you through installing Node.js on a DreamHost VPS or dedicated server.

Contents5
  1. Does DreamHost support nodeJS?
  2. Can you run Node.js on DreamHost shared hosting?
  3. How to install nodejs on DreamHost VPS?
  4. How to connect your Node.js app to your domain
  5. Conclusion

Does DreamHost support nodeJS?

Yes, on Managed VPS and dedicated servers. DreamHost's help center says Node.js apps can only be installed on those two plans, so shared hosting doesn't support Node.js apps.

nodejs support in dreamhost

Node.js doesn't come pre-installed in a version you control. You install it yourself with Node Version Manager (nvm), then connect your app to your domain.

memory limits for nodejs in dreamhost

Visit DreamHost

Can you run Node.js on DreamHost shared hosting?

No. Older guides, including an earlier version of this article, described a custom install through Passenger on shared hosting. DreamHost now says Node.js apps can only be installed onto Managed VPS and Dedicated Servers.

If your site is on shared hosting, you can upgrade to a DreamHost VPS from the panel, or host the Node.js app elsewhere and keep your website on shared hosting.

How to install nodejs on DreamHost VPS?

The steps below follow DreamHost's guide to installing a custom version of nvm and Node.js. Run them over SSH as your website's user (you can find the SSH details in the panel under your website's user). DreamHost support can't help with custom installs, so follow them carefully.

  • Go to your user's home directory:
  • Download and run the nvm installer. DreamHost's guide uses version 0.40.1; check the nvm-sh page on GitHub for the newest release:
  • Reload your settings and check that nvm is installed:
  • Dedicated servers only: set the security flag on nvm, or it may be blocked:
  • Install the current long-term support (LTS) release of Node.js:
  • Dedicated servers only: after each new version, set the same flag on the node, npm and npx files:
  • Make that version the default and check it:

Next, install your app's packages. From your app's folder, this command installs every dependency listed in its package.json file:

How to connect your Node.js app to your domain

A Node.js app can't use ports 80 and 443 directly on DreamHost. You have two options.

Option 1: Proxy server (DreamHost's current method)

  • Run your app on a non-privileged port between 8000 and 65535.
  • In the DreamHost panel, add a Proxy Server for your domain and point it to that port. Your SSL certificate keeps working this way.

As a quick test, put this in an app.js file (8002 is the port):

  • Run it with this command, then open your domain to see "SUCCESS":

For a real app, use a process manager such as pm2 so the app restarts if it stops.

Option 2: Passenger

If your website's settings in the DreamHost panel still show the Passenger option, you can let Passenger run the app instead:

  • Log in to your DreamHost panel and open Manage Websites.
  • Find the website and open its settings.
  • In Additional Options, click Modify, enable Passenger, and then enable NodeJS (not RVM).

installing nodejs on dreamhost vps

  • Set the public directory. If it doesn't exist, DreamHost creates it. The setup usually takes 5 to 10 minutes.

configuration of nodejs public directory

Passenger looks for an app.js file, so rename server.js to app.js if your app uses that name. To make Passenger use the Node.js version you installed with nvm, the .htaccess file in your public folder needs a line like this (replace the version number with yours, which node --version shows):

After a change, restart the app from its folder:

You can also click Reload HTTP in the VPS section of the panel.

reload http in dreamhost

Visit DreamHost

Conclusion

DreamHost runs Node.js apps on its Managed VPS and dedicated servers, not on shared hosting. Install Node.js with nvm, then connect the app to your domain with a proxy server or Passenger.

If something doesn't work, check DreamHost's help center first, since its support team doesn't troubleshoot custom installs.