Skip to main content

How you can deploy an Angular App on Hostinger VPS in 2026 — Step by Step Guide

Updated 5 min readMarkdown
How you can deploy an Angular App on Hostinger VPS in 2026 — Step by Step Guide

You've built your Angular app locally and it works. Now you need it live on a real server — fast, stable, and without paying for a managed platform you don't really need yet. This guide walks through the complete deployment on a VPS, starting from a fresh Ubuntu server and ending with a production-ready Angular app served over HTTPS.


What You'll Need

  • A VPS plan with root access (Hostinger's KVM 1 tier works well for this)

  • An Angular app that builds locally with ng build

  • A domain name pointed to your server (optional, but recommended)

  • Basic comfort with a terminal

No prior DevOps experience required — every command below is explained.


Why a VPS Instead of a Managed Platform?

A VPS gives you a full Linux environment with root access. That means you can run Node.js, NestJS, PostgreSQL, PM2, and Nginx — anything you need — on the same machine, with no cold starts and no platform-imposed limitations.

For a side project or an early-stage product, this tends to be the most cost-efficient way to get a real production environment, at the cost of handling your own server maintenance.


Step 1 — Set Up the Server

After provisioning your VPS, log in to your hosting dashboard and:

  1. Choose Ubuntu 22.04 LTS as the operating system — it's the most stable choice for Node.js apps right now

  2. Note the server's IP address

  3. Set a root password, or better, add your SSH public key

The server is usually ready within a couple of minutes.


Step 2 — Connect via SSH

ssh root@YOUR_SERVER_IP

Or with a key pair:

ssh -i ~/.ssh/your_key root@YOUR_SERVER_IP

Step 3 — Update the Server and Install Node.js

apt update && apt upgrade -y

Install Node using nvm, which makes version management much easier:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
nvm install --lts
nvm use --lts
node -v

Step 4 — Install Nginx and PM2

Nginx will serve the built Angular files. PM2 keeps any Node backend processes alive and restarts them if they crash.

apt install nginx -y
npm install -g pm2

Step 5 — Build the Angular App Locally

ng build --configuration=production

This produces a dist/your-app-name/browser/ folder — that's what gets uploaded to the server.


Step 6 — Upload the Build

scp -r dist/your-app-name/browser root@YOUR_SERVER_IP:/var/www/your-app

Or, for faster repeat deploys:

rsync -avz dist/your-app-name/browser/ root@YOUR_SERVER_IP:/var/www/your-app/

Step 7 — Configure Nginx

Create a new server block:

nano /etc/nginx/sites-available/your-app
server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;

    root /var/www/your-app;
    index index.html;

    location / {
        try_files \(uri \)uri/ /index.html;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }
}

The try_files \(uri \)uri/ /index.html line matters more than it looks — without it, refreshing any route other than / returns a 404, because Nginx doesn't know about Angular's client-side routes.

ln -s /etc/nginx/sites-available/your-app /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginx

The app is now reachable at the server's IP address.


Step 8 — Point a Domain at the Server

Add an A record in your domain registrar's DNS settings:

Type Name Value
A @ your server IP
A www your server IP

DNS propagation usually takes somewhere between 5 and 30 minutes.


Step 9 — Add SSL

apt install certbot python3-certbot-nginx -y
certbot --nginx -d yourdomain.com -d www.yourdomain.com

Certbot edits the Nginx config automatically and sets up renewal. Confirm renewal works correctly:

certbot renew --dry-run

The app is now served over HTTPS.


Step 10 — Running a Node Backend Alongside It (Optional)

If the Angular app talks to a NestJS or Express backend, run it through PM2:

cd /var/www/your-backend
npm install
pm2 start dist/main.js --name "api-server"
pm2 save
pm2 startup

Then proxy API requests through Nginx:

location /api {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
}

Updating the App Later

Once this is set up, future deploys are quick:

ng build --configuration=production
rsync -avz dist/your-app-name/browser/ root@YOUR_SERVER_IP:/var/www/your-app/

No Nginx restart needed for static file changes. If the backend changed:

pm2 restart api-server

Common Questions

How much traffic can a small VPS handle? For a static Angular app served through Nginx, even an entry-level VPS (1 vCPU, a few GB of RAM) comfortably handles tens of thousands of monthly visitors — Nginx is very efficient at serving static files.

Can I run multiple Angular apps on one server? Yes — add a separate Nginx server block for each app, pointing to its own directory and domain. A single small VPS can typically run several small apps without issues.

What if I don't have a domain yet? You can test directly against the server's IP address during development and add the domain and SSL steps later.

Does this work for Angular Universal (SSR)? Yes — SSR runs as a Node process, so PM2 manages it the same way it manages any backend, and Nginx proxies requests to it instead of serving static files directly.


A VPS setup like this takes around 30 minutes the first time you do it, and a couple of minutes for every deploy after that. It's a reasonable middle ground between fully managed hosting and rolling your own infrastructure from scratch — full control, predictable cost, and nothing you don't actually need.

If you run into an issue following this, leave a comment with what you're seeing — happy to help debug.

About the author

  • Practical guides for frontend developers — Development, hosting, and the tools that actually work

No comments yet. Be the first to comment.