Back to tools
Nginx Config Generator
Build a complete server block for a static site, reverse proxy, or load balancer. SSL, gzip, caching and the request-path traps that bite in production are handled for you — copy, save, reload.
Server
Domain & mode
Pick what nginx should do with requests for this domain.
TLS
SSL / HTTPS
This assumes the certificate is already issued. Need to actually obtain one? Use the SSL Certificate Command Generator for the Certbot commands — that step is out of scope here.
Performance
Gzip, caching & upload limits
Validation
Common nginx traps, checked live
These are the misconfigurations that pass nginx -t without complaint and only show up once traffic hits the box.
Correct listen directive for TLS
listen 443 ssl; — not just listen 443; — so nginx actually terminates TLS on this port instead of silently serving plain HTTP.
client_max_body_size is set explicitly
10m is allowed through, so uploads up to that size will not get a silent 413.
Output
Generated server block
nginx config
# --- HTTP -> HTTPS redirect ---
server {
listen 80;
listen [::]:80;
server_name play.wespner.eu;
return 301 https://$host$request_uri;
}
# --- HTTPS server ---
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name play.wespner.eu;
ssl_certificate /etc/letsencrypt/live/play.wespner.eu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/play.wespner.eu/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# Compression
gzip on;
gzip_vary on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
client_max_body_size 10m;
# Static asset caching
location ~* \.(css|js|mjs|json|jpg|jpeg|png|gif|svg|webp|ico|woff2?|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
root /var/www/play.wespner.eu/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}save & activate
# Save the block above as: /etc/nginx/sites-available/play.wespner.eu # Enable it and reload: sudo ln -s /etc/nginx/sites-available/play.wespner.eu /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx
Running your own game server?
Wespner game servers with DDoS protection, NVMe drives and activation within minutes.