Nginx Reverse Proxy with Certbot Let's Encrypt SSL
Configure an Nginx reverse proxy on Ubuntu with automated SSL/TLS certificates and HTTP to HTTPS redirection.
Goal
Forward incoming public HTTPS web traffic on ports 80/443 to an internal Node.js or Docker application listening on port 3000, with automated Let's Encrypt SSL certificates.
Prerequisites
- Ubuntu 22.04 or 24.04 VPS
- Registered domain name with an
Arecord pointing to the server's public IP address - Backend application running locally (e.g. port 3000)
```nginx
server {
server_name docs.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
# WebSocket and Connection headers
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
# Client identity headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
```# Verify configuration syntax
sudo nginx -t
# Reload Nginx
sudo systemctl reload nginx
``````bash
sudo certbot --nginx -d docs.example.com --non-interactive --agree-tos -m admin@example.com --redirect
```Automated Renewal Verification
Certbot automatically installs a systemd timer for certificate renewal. Verify renewal works cleanly:
sudo certbot renew --dry-runNode.js + PostgreSQL with Docker Compose
Complete full-stack development environment setup connecting a Node.js Express/TypeScript backend with a containerized PostgreSQL database using Docker Compose.
Deploy Next.js App on Ubuntu VPS (Standalone + PM2 + Nginx + SSL)
Step-by-step production deployment guide for Next.js App Router on an Ubuntu VPS using standalone output, PM2 cluster mode, Nginx reverse proxy, and SSL.