Reverse Proxy SetupBeginner
1Question 1 of 1
nginxHow do you configure Nginx as a Reverse Proxy and SSL/TLS termination gateway?
Explanation & Concept
Nginx acts as a high-performance reverse proxy that accepts client requests, terminates SSL certificates, and forwards requests to backend application servers (Node.js, Python, Go) while buffering slow clients.
Code Example
nginx
server {
listen 80;
server_name api.domain.com;
return 301 https://$host$request_uri; # Redirect HTTP to HTTPS
}
server {
listen 443 ssl http2;
server_name api.domain.com;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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;
}
}How It Works & Key Takeaways
Nginx handles HTTPS decryption on optimized C cores, passing plain HTTP to backend application instances and freeing up CPU cycles.
Mock Test · 1 Questions · Optional
Ready for Load Balancing?
Take a quick test to evaluate yourself, or move straight to the next module.
Beginner3 questions