server {
listen 80;
server_name cdn.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name cdn.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/cdn.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/cdn.yourdomain.com/privkey.pem;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:7100;
proxy_http_version 1.1;
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;
# Disable buffering to allow smooth streaming uploads
proxy_request_buffering off;
proxy_buffering off;
}
}In production, you should never expose port 7100 directly over unencrypted HTTP. Instead, place an Nginx reverse proxy in front of the container to handle SSL certificates and custom domains like cdn.yourcompany.com.
Step 1: Point Your DNS Record#
Create an A Record in your DNS provider (Cloudflare, Namecheap, Route53):
- Type:
A - Name:
cdn(or@for apex domain) - Value: Your VPS Server Public IPv4 Address
- TTL: Auto / 300 seconds
Step 2: Install Certbot & Obtain Free SSL#
On your Ubuntu or Debian VPS:
bashsudo apt update sudo apt install -y nginx certbot python3-certbot-nginx # Obtain free Let's Encrypt SSL: sudo certbot certonly --nginx -d cdn.yourdomain.com
Step 3: Configure Nginx Reverse Proxy#
Create a new Nginx configuration file:
bashsudo nano /etc/nginx/sites-available/cdn.conf
Paste the production configuration below:
nginxserver { listen 80; server_name cdn.yourdomain.com; return 301 https://$host$request_uri; } server { listen 443 ssl http2; server_name cdn.yourdomain.com; # SSL Certificates ssl_certificate /etc/letsencrypt/live/cdn.yourdomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/cdn.yourdomain.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers HIGH:!aNULL:!MD5; # Allow uploads up to 100MB client_max_body_size 100M; location / { proxy_pass http://127.0.0.1:7100; proxy_http_version 1.1; 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; # Disable proxy buffering so uploads stream directly to storage engine proxy_request_buffering off; proxy_buffering off; } }
Enable the configuration and reload Nginx:
bashsudo ln -s /etc/nginx/sites-available/cdn.conf /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl reload nginx
Step 4: Verify Custom Domain#
Make a test request to your new custom domain:
bashcurl -I https://cdn.yourdomain.com/health
Expected response:
httpHTTP/2 200 content-type: application/json; charset=utf-8
Your DevCloudDesk Storage Server is now fully production-ready, secured with automated HTTPS, and running on your branded custom domain!
Next Steps#
- Client SDK Installation →: Configure your SDK to point to your new
https://cdn.yourdomain.comendpoint. - On-the-Fly Image Transformations →: Explore WebP conversion and resizing.