About the Nginx Config Generator
This tool builds Nginx server blocks in your browser with no upload. You pick Domain, Site type, App port, Website folder and toggles for HTTPS, www handling, gzip, 30-day caching and security headers. The generator writes three server blocks: a port 80 block that sends visitors to HTTPS, a 301 redirect for www or non-www, and the main HTTPS block with Let's Encrypt paths, TLS 1.2 and 1.3, and HTTP/2. Reverse proxy mode sets proxy headers, preserves the real IP and supports WebSockets. The page updates results as you type and you can copy the config or share a link that reopens your inputs. The tool shows the certbot command and warns you to get the certificate first, because Nginx will not start with missing cert paths. Always run sudo nginx -t before reloading Nginx.
How to use it
- 1Choose Domain and Site type.
- 2Set App port and Website folder, and pick HTTPS and www handling.
- 3Toggle gzip, caching and security headers.
- 4Copy the generated config, run certbot if using Let's Encrypt, then test with sudo nginx -t and reload.
Worked example
Inputs: Domain: example.com Site type: Reverse proxy to an app (Node.js) App port: 3000 Website folder: /var/www/example HTTPS: HTTPS with Let's Encrypt certificates www: Send www to example.com Gzip compression: On Cache images, CSS and JS for 30 days: Yes Security headers: Add them Generated Nginx config: server { listen 80; server_name example.com www.example.com; return 301 https://example.com$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name www.example.com; return 301 https://example.com$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name example.com; root /var/www/example; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; gzip on; location / { proxy_pass http://127.0.0.1:3000; 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; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico)$ { expires 30d; add_header Cache-Control "public"; } add_header X-Content-Type-Options nosniff; add_header X-Frame-Options SAMEORIGIN; add_header Referrer-Policy no-referrer-when-downgrade; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; } Certbot example to get certificates first: sudo certbot --nginx -d example.com -d www.example.com # needs python3-certbot-nginx Then test and reload: sudo nginx -t sudo systemctl reload nginx
How it works
Writes server blocks for Nginx: a port 80 block that sends visitors to HTTPS, a block that redirects the www or non-www name with a 301, and the main block with Let's Encrypt certificate paths, TLS 1.2 and 1.3, HTTP/2, optional gzip, 30-day browser caching of static files and security headers (nosniff, SAMEORIGIN frames, a referrer policy and HSTS on HTTPS)Reverse proxy mode forwards the Host, real IP and protocol headers and supports WebSocketsSource: Nginx documentation - switches and testingCertbot documentation - obtain certificatesMozilla Server Side TLS recommendations. Last checked 6 November 2026.
What it is good for
- Runs fully in your browser with no upload.
- Generates HTTP, HTTPS and www redirects plus main server block.
- Includes gzip, 30-day static caching and common security headers.
- Only generates a single server block set per run, not multi-site pools.
- You must obtain TLS certificates yourself before Nginx will start with the supplied paths.
Questions people ask
Will this tool install TLS certificates for me?
No. The tool only outputs config text and shows the certbot command. You must run certbot or another ACME client to obtain certificates and place them at the paths shown.
Is my domain data sent to a server?
No, this tool runs in your browser and does not upload inputs. Still check your browser settings and network policies if you need stricter privacy.
Where should I save the generated file on my server?
On Debian and Ubuntu save it to /etc/nginx/sites-available/your-site then symlink to /etc/nginx/sites-enabled/. Some systems use /etc/nginx/conf.d/ instead. Run sudo nginx -t before reloading.
How do I test the generated config before applying it?
Run sudo nginx -t to test syntax. If the test passes, reload with sudo systemctl reload nginx or sudo nginx -s reload to apply the change.
Will reverse proxy mode handle WebSockets?
Yes. The generated proxy block includes proxy_http_version 1.1 and Upgrade and Connection headers. You should still confirm upstream timeouts and keepalive settings for your app.
Do the TLS lines work on every Nginx build?
Not always. Features like TLS 1.3 require a compatible OpenSSL and Nginx build. Check nginx -V and adjust protocols and ciphers to match your build.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.