How to Set Up Nginx Reverse Proxy with SSL on Ubuntu 24.04 (Complete Blueprint)
Hostinger vs. Contabo: Full Specifications Breakdown
Data verified from our lab benchmarks • Updated for 2026
| Feature / Metric | HostingerEditor's Choice UI | ContaboMax RAM Value |
|---|---|---|
| Starting Price | $2.99 / month (Web) | $4.99 / mo (VPS) | $5.50 / month (Cloud VPS S) |
| vCPU Cores | 1 to 8 vCPU (Dedicated resources) | 4 to 12 vCPU (High Core Count) |
| RAM Memory | 4 GB to 32 GB | 6 GB to 64 GB (Gigantic RAM) |
| Storage Technology | 50 GB – 400 GB NVMe SSD | 50 GB NVMe or 300 GB SSD |
| Traffic / Bandwidth | 4 TB to 32 TB | 32 TB Outgoing + Unlimited In |
| Control Panel & UI | hPanel (Ultra Modern & Easy) | cPanel, Plesk, Webmin, or CLI |
| Customer Support | 24/7 Live Chat & AI Support (Multi-lingual) | Email Ticket Support (German Business Hours) |
| Best For | Bloggers, WordPress Sites & Devs wanting easy UI | Heavy Database, Docker, Game Servers & SysAdmins |
| Money-Back Guarantee | 30-Day Money-Back Guarantee | 14-Day EU Statutory Cancellation |
| Official Links | Visit Hostinger | Visit Contabo |
What is a Reverse Proxy and Why is Nginx the Best Choice?
A reverse proxy sits between public client connections and private backend application servers (such as a Next.js frontend running on port 3000, an Express API on port 5000, or a FastAPI Python backend on port 8000). Nginx handles TLS certificate negotiation, HTTP/2 multiplexing, static asset caching, and request buffering, isolating your application runtime from direct Internet attacks.
Step 1: Installing Nginx on Ubuntu 24.04
sudo apt update
sudo apt install -y nginx
Step 2: Creating a Production Reverse Proxy Virtual Host
Create a dedicated virtual host configuration in /etc/nginx/sites-available/api.example.com:
sudo nano /etc/nginx/sites-available/api.example.com
Add the following production configuration with proxy buffering and WebSocket upgrades:
# Upstream pool pointing to local application backend
upstream backend_app {
server 127.0.0.1:3000;
keepalive 32;
}
server {
listen 80;
listen [::]:80;
server_name api.example.com;
# Redirect all plain HTTP traffic to secure HTTPS
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name api.example.com;
# SSL Certificate Paths (provisioned by Certbot)
ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem;
# Reverse Proxy Location Block
location / {
proxy_pass http://backend_app;
proxy_http_version 1.1;
# WebSocket support
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Forward authentic client IP and host 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;
# Timeouts and Buffer Sizes
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
}
Step 3: Enabling Site and Validating Syntax
sudo ln -s /etc/nginx/sites-available/api.example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 4: Tuning Gzip Compression & Rate Limiting
Enable gzip compression in /etc/nginx/nginx.conf to compress JSON payloads and CSS/JS assets on the fly:
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml image/svg+xml;
Protect against API denial-of-service floods by configuring IP rate limiting in http {} block: limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;.
Frequently Asked Questions (FAQ)
How do I handle 502 Bad Gateway errors in Nginx?
A 502 error indicates Nginx received no response from the upstream application. Verify your backend service (Node.js/Python) is actively running on port 3000 with curl http://127.0.0.1:3000 or pm2 status.
Editorial Verdict: Pros & Cons
What We Love (Pros)
- Terminates TLS/SSL encryption at the edge, freeing application workers from cryptographic overhead
- Provides centralized rate limiting, caching, and gzip/brotli compression
- Full support for bidirectional WebSocket connections
Drawbacks (Cons)
- Misconfigured proxy buffer sizes can truncate large JSON API responses
Written by Marcus Sterling
DevOps & Cloud Engineer
Alex and the ServerCraft engineering lab run routine benchmarks on over 25 web hosting providers, maintaining strict objectivity and reproducibility.
Recommended Next Reads
Hostinger vs Contabo VPS (2026): Real Benchmark Test & In-Depth Comparison
A comprehensive, benchmark-driven comparison between Hostinger and Contabo VPS. We tested Geekbench CPU scores, NVMe I/O, network latency, and hPanel vs CLI.
Hostinger Review (2026): Is It Truly the Best Web Hosting for the Price?
We stress-tested Hostinger's Premium and Cloud Startup plans across 180 days. Read our honest review covering uptime, LiteSpeed speed tests, and renewal fees.