If you run backend servers built with Node.js, Express, FastAPI, Django, Go, or Rust on a VPS (DigitalOcean, Linode, AWS, Hetzner, OVH), you need a reverse proxy to manage incoming HTTP/HTTPS traffic, terminate SSL, and route requests to internal application ports.
Here is how to set up your free devs.surf subdomain with Nginx and free Let's Encrypt certificates in under 10 minutes.
Step 1: Point Your Subdomain to VPS IP
In the Devs.Surf Dashboard:
- Add an A Record:
- Type:
A - Name:
@ - Content:
YOUR_VPS_PUBLIC_IPV4 - TTL:
3600
- Type:
Step 2: Install Nginx and Certbot
On Ubuntu or Debian Linux:
sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx
Step 3: Configure Nginx Server Block
Create a configuration file at /etc/nginx/sites-available/api.devs.surf.conf (replace api.devs.surf with your actual subdomain):
server {
listen 80;
server_name api.devs.surf;
location / {
proxy_pass http://127.0.0.1:3000; # your app port
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;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable the site and test configuration:
sudo ln -s /etc/nginx/sites-available/api.devs.surf.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 4: Obtain Automated SSL with Certbot
Run Certbot to automatically issue and configure Let's Encrypt HTTPS certificates:
sudo certbot --nginx -d api.devs.surf
Certbot will perform the HTTP challenge, obtain the certificate, and update your Nginx configuration with automatic HTTPS redirection. Test auto-renewal with:
sudo certbot renew --dry-run