server {
listen 80;
server_name example.com www.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Check the file, then reload Nginx. The -t switch tests the config. The -s reload switch applies it:
sudo nginx -t
sudo nginx -s reload
Open http://example.com. You should see your app. If your app uses WebSockets, read the nginx.org WebSocket page. The docs say that proxying them needs extra settings.
Step 5: Nginx node js reverse proxy https with Let's Encrypt
Certbot gets a free certificate from Let's Encrypt and edits your Nginx file for you. The Certbot site recommends the snap install on Linux. A snap is a packaged app that updates itself. Your domain must already point to the server.
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/local/bin/certbot
sudo certbot --nginx
sudo certbot renew --dry-run
If you installed Certbot with apt before, remove that copy first, as the Certbot page says. The Certbot page also says its install adds a cron job or systemd timer that renews certificates. The last command tests that renewal works.
Visit https://example.com and look for the lock icon.
Step 6: Firewall and updates
A firewall blocks every port you do not open. Ubuntu uses UFW. Allow SSH first, or you will lock yourself out. The Ubuntu firewall guide gives these commands:
sudo ufw allow ssh
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
sudo ufw status
Your Node.js port stays closed. Nginx reaches it on the same machine, so the outside world does not need it.
For updates, Ubuntu installs the unattended-upgrades package by default. The Ubuntu docs say it applies security updates once a day. It does not reboot the server unless you turn that on. Run sudo apt update and sudo apt upgrade yourself now and then. Reboot when an update asks for it.
Use the same pattern for new code. Pull it, run npm install, then run pm2 reload myapp. To automate this, see GitLab vs GitHub.
Node js server vs nginx
Node.js runs your code. Nginx handles the web traffic in front of it. You use both together, and they do not replace each other.
Nginx ends the HTTPS connection, serves files, and passes requests to Node.js. Your app only runs your logic. This also lets you run several apps on one server. Each app gets its own port and its own server block.
You can skip Nginx for a small test. For a real site, use the reverse proxy.
Node js hosting cost on a VPS
A VPS that runs a Node.js app costs about $6 to $24 a month in 2026, according to the providers' pricing pages. The price depends on RAM and on how long you commit. Hostinger asks for 24 months up front, while DigitalOcean and Hetzner bill by the hour with a monthly cap.
| Plan | RAM | 12 months | 24 months | 48 months |
| Hostinger KVM 1 ($6.49 per month, then $11.99) | 4 GB | $155.76 (24-month term only) | $155.76 | $443.52 |
| Hostinger KVM 2 ($8.79 per month, then $14.99) | 8 GB | $210.96 (24-month term only) | $210.96 | $570.72 |
| DigitalOcean Basic Droplet ($12 per month) | 2 GiB | $144 | $288 | $576 |
| DigitalOcean Basic Droplet ($24 per month) | 4 GiB | $288 | $576 | $1,152 |
| Hetzner CX23 (5.99 euros per month, VAT extra) | 4 GB | 71.88 euros | 143.76 euros | 287.52 euros |
Sources: the Hostinger VPS page, the DigitalOcean Droplet pricing page and the Hetzner Cloud pages (checked 14 November 2026). We worked out the totals ourselves. Hostinger 48 months is $155.76 for the first 24 months plus 24 times the renewal price. The other totals assume the price stays the same.
Hetzner lists the CX23 for 5.99 euros, but its page said the product was currently unavailable when we checked. Check stock first. DigitalOcean has a 1 GiB plan at $6 a month (DigitalOcean, 2026). That is enough for a small test app. For the full price picture, read our cheap VPS hosting comparison.
Low-cost Node.js hosting also exists as a managed plan, where the company runs the server for you. Hostinger's Node.js hosting page lists a plan from $2.79 a month on a 48-month term that renews at $16.99 a month. We did not check that plan's limits, so read them before you compare it with a VPS.
How to deploy node js application on Hostinger VPS
You follow the same six steps as above. The steps do not change on Hostinger. Choose a plain Ubuntu image when you set up the server, so the commands in this guide match.
Hostinger's VPS page lists an "OpenLiteSpeed and Node.js" one-click template. It also lists plain operating systems such as Ubuntu and Debian. A template installs its own web server, so it does not match this Nginx guide.
According to Hostinger's VPS page, KVM 1 has 1 vCPU, 4 GB of RAM and 50 GB of NVMe storage for $6.49 a month. That price needs a 24-month term, and the total is $155.76 up front. KVM 2 has 2 vCPU and 8 GB for $8.79 a month on the same term. The renewal prices are $11.99 and $14.99 a month. Check the renewal price before you buy.
Hosting option for this guide

Disclosure: this link is an affiliate link. Tutorsbot may earn a commission if you buy, at no extra cost to you.
Hostinger fits you if you want a lot of RAM for a low first price and you know the app will run for two years. It is the wrong choice if you want to pay month to month, since the offer needs a 24-month term and the money-back guarantee lasts 30 days. DigitalOcean and Hetzner bill by the hour, so you can delete a server when the project ends.
Who should not use a VPS
A VPS is the wrong tool in some cases. You do the security and updates yourself. Think about these options first:
- You do not want to manage a server. Use a managed platform instead.
- Nobody on your team can fix a server at night. A platform that restarts and patches for you is safer.
- Your app gets huge, uneven traffic. A VPS has a fixed size, and scaling needs more work.
- You only need a free test for a few days. A free tier or a short, hourly-billed server costs less.
If you are new to hosting, read what is cloud computing first.
Photo: Direct URL (https://commons.wikimedia.org/wiki/Special:FilePath/Racks_Amravati_Data_Center.jpg?width=1200) — verify license before use