Linux KVM VPS HostingWeb & SSL Security
Nginx Reverse Proxy & SSL Certificates
Route public web traffic securely to your background Docker containers or web applications with high-performance Nginx reverse proxy and automated Let’s Encrypt TLS encryption.
1. Installing Nginx Web Server
Install Nginx
sudo apt update
sudo apt install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx2. Creating a Reverse Proxy Virtual Host
Create a configuration file at /etc/nginx/sites-available/app.conf:
/etc/nginx/sites-available/app.conf
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:3000; # Forward to your Node.js or Docker app
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}Enable the site and reload Nginx:
Enable Site
sudo ln -s /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx3. Obtaining Free Let’s Encrypt SSL via Certbot
Install Certbot with the Nginx plugin and request an SSL certificate:
Issue SSL
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.comCertbot automatically verifies domain ownership via HTTP challenge, installs the certificate, and configures an automatic 301 HTTPS redirect.
4. Verifying Automated SSL Renewal
Test the automated renewal daemon:
Test SSL Renewal
sudo certbot renew --dry-runLet’s Encrypt certificates renew automatically every 60 days via the built-in systemd timer.
Was this documentation page helpful?