How do I Host My Node.js Application on Linode?

Linode Staff

I created an application using Node.js and I want to host it on Linode with my custom domain name and enable HTTPS. How do I deploy my app to a server?

1 Reply

Hosting your Node.js app on Linode is pretty simple. Basically, you'll need to spin up a server running Node.js and Nginx (to serve the app to the web), point your domain to your IP, enable HTTPS, and upload your code. There are several ways to do this so I'll walk you through a few strategies with varying levels of customization.

1. Create an Account

First, you'll want to create an account with Linode, if you don't already have one. You can find promotional offers that give all new customers a $100/60-day credit in our Docs and in the comments on the Linode Youtube Channel.

2. Choose a Deployment Strategy

There's always more than one way to do a job. The same is true for hosting your Node.js app on the Linode platform. It just depends on what level of manual configuration you would like and are comfortable with.

Full Marketplace Configuration

The simplest route is to fully configure the deployment available in the Marketplace since once the setup is complete, a default Node.js app is available at your domain with HTTPS enabled. In order to do this, you will need to be hosting your domain on Linode's name servers.

Following this guide, you can easily deploy an instance of any plan size running Node.jsfrom the Linode Marketplace. Once you input your configuration settings, just wait 10-15 minutes to ensure the app deployed successfully. You can check the Lish console for indication that the installation is complete:

Running initial updates - This will take a while...
Installation complete!

You can then navigate to domain you entered during the setup process a "voila!" your default Node.js app is available on the web, and secured with HTTPS.

Partial Markplace Configuration

If you're not hosting your domain on Linode's name servers, the Markeplace deployment still makes hosting your Node.js app simpler. It just takes some reconfiguration once the server is up and running.

First, point your A record to the IP address of your new instance from your domain registrar's dashboard. After the application has fully deployed and you're able to see the Hello World Powered By Linode Marketplace message on the rDNS domain, connect to your instance via SSH. From there, set your server's hostname and update the system's host file.

Now it's time to reconfigure your webserver. You'll start by removing the original certificates installed during the Marketplace setup using the sudo certbot delete command:

sudo certbot delete
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Which certificate(s) would you like to delete?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

Next, delete the Nginx configuration files that were created for the web server:

sudo rm -rf /etc/nginx/sites-available/
sudo rm /etc/nginx/sites-enabled/

Then, follow this guide to create a basic Nginx reverse proxy configuration file to start serving the default Node.js application to your domain making sure to replace with your desired domain name. Since certbot is already installed, you can run the sudo certbot --nginx command to search your instance's configuration files and automatically configure and install the Let's Encrypt SSL certificates necessary for HTTPS.

Once that is finished running, the default app should be serving content on your domain!

Manual Installation

Some folks like to have full control of what is and is not being installed on their instance. In that case can use one of the following guides to install Node.js on your distribution of choice:

You will of course want to take the additional steps needed to configure and secure your instance once it's provisioned. When the application is installed, again, you can use the Nginx as a Reverse Proxy guide to serve your application to the web.

From there, it's a matter of configuring your DNS records and installing certbot to enable HTTPS.

You can also take a look at everything included in the Marketplace app deployment to see if there's anything else you may want to include in your instance.

3. Upload your Code

If you've got your code in a GitHub repo, awesome! This section of our video with Jay from @LearnLinuxTV has instructions for cloning your GitHub repository. You'll need to have the git utility installed on your server.

Alternatively, you can upload your source files to your Linode using a few different methods such as scp, rsync, Cyberduck, or Filezilla.

Once it's uploaded to the cloud, you can run your app and start serving your content to the web. Hooray!

It's important to note that if you deployed Node.js through the Marketplace, the default application is likely still running. To stop the process, you'll need to switch to the root user and run the following command:

pm2 stop 0

For reference, the default app files are located in the /opt/nodejs directory.

Going Further

If your application requires a database connection, you can use the following resources to help get that configured:

Questions about Node.js? I suggest reaching out in on the Discussions Page in the Node.js GitHub repo.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct