Saturday, 21 November 2026 Press Releases Newsletter RSS
Breaking
WhatsApp Business Account Hacked in Pakistan: Full Recovery Guide Special Technology Zones Authority (STZA) & IT Park Expansion in Pakistan: Islamabad, Karachi, and Lahore Ground Report Pakistan Software Export Board & Industry Consortium Launch 'TechBridge Pakistan 2026' to Connect 500 Startups With Global Markets Global Tech Safety Summit 2026: International Standards for Frontier AI and Data Security Announced WhatsApp Business Account Hacked in Pakistan: Full Recovery Guide Special Technology Zones Authority (STZA) & IT Park Expansion in Pakistan: Islamabad, Karachi, and Lahore Ground Report Pakistan Software Export Board & Industry Consortium Launch 'TechBridge Pakistan 2026' to Connect 500 Startups With Global Markets Global Tech Safety Summit 2026: International Standards for Frontier AI and Data Security Announced
WritePures

Your applications listen on localhost. Something has to accept traffic from the internet, terminate TLS and route to the right one. That is a reverse proxy.

Point your domain first

At your DNS provider, create an A record:

Type: A      Name: @        Value: YOUR_SERVER_IP
Type: A      Name: www      Value: YOUR_SERVER_IP

Add an AAAA record for IPv6 if your server has one. Then wait, and check:

dig +short yourdomain.com

It must return your server's IP before you continue. Certificate issuance works by proving you control the domain, and it fails if DNS has not propagated — producing an error that looks like a proxy problem and is not.

Caddy, because the certificates handle themselves

Nginx is more widely known. Caddy obtains and renews Let's Encrypt certificates automatically with no cron job and no extra tooling, which on a small server is worth more than familiarity.

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | \
  sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | \
  sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy -y

Open the ports:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Port 80 is needed even though you want HTTPS — it is used for the certificate challenge and to redirect visitors to HTTPS.

The configuration

sudo nano /etc/caddy/Caddyfile
yourdomain.com {
    reverse_proxy 127.0.0.1:8080
}

That is the entire file. Reload:

sudo systemctl reload caddy

Visit your domain. You have HTTPS, with a valid certificate, that renews itself. Watch it happen if something goes wrong:

sudo journalctl -u caddy -f

Several applications, one server

app.yourdomain.com {
    reverse_proxy 127.0.0.1:8080
}

api.yourdomain.com {
    reverse_proxy 127.0.0.1:3000
}

status.yourdomain.com {
    reverse_proxy 127.0.0.1:9090
    basic_auth {
        admin $2a$14$...        # generate with: caddy hash-password
    }
}

Each subdomain needs its own DNS record pointing at the same IP. The proxy sorts out which application receives the request.

That basic_auth block is the pattern for anything administrative — dashboards, metrics, admin panels. It is the simplest correct answer to "how do I expose this without exposing it".

Useful additions

yourdomain.com {
    encode gzip zstd              # compress responses
    reverse_proxy 127.0.0.1:8080

    header {
        Strict-Transport-Security "max-age=31536000"
        X-Content-Type-Options "nosniff"
        X-Frame-Options "SAMEORIGIN"
    }

    log {
        output file /var/log/caddy/access.log
    }
}

Add HSTS only once you are certain HTTPS works, because it tells browsers to refuse plain HTTP for your domain for a year.