the IT Hustle
ToolsField ManualAbout

Nginx Config Generator

Build Nginx configuration files without memorizing directives. Visual server blocks, location rules, proxy_pass, SSL, and caching. Start from templates for common setups.

Nginx Config Generator

Build nginx.conf visually. Configure server blocks, location rules, SSL, gzip, and caching. Start from templates or build from scratch.

Templates
Server Block
Listen Port
Server Name
Root
Location Blocks (2)
Location 1
Path
Type
Try Files
Location 2
Path
Type
nginx.conf
server {
    listen 80;
    server_name example.com;
    root /var/www/html;
    access_log /var/log/nginx/access.log;

    gzip on;
    gzip_types text/plain text/css application/json application/javascript text/xml;
    gzip_min_length 1000;

    location / {
        try_files $uri $uri/ =404;
    }

    location /assets/ {
        autoindex off;
        expires 365d;
        add_header Cache-Control "public, immutable";
    }

}

How to Generate an Nginx Config

Build nginx server blocks for static sites, proxies, and SPAs with The IT Hustle's free Nginx Config Generator.

  1. 1
    Pick a templateStart from Static Site, Reverse Proxy, SPA (React/Next.js), WordPress, or SSL Redirect to load a working baseline.
  2. 2
    Set the server basicsConfigure the listen port, server name, and document root for your site.
  3. 3
    Enable SSL and gzipAdd your certificate and key paths for HTTPS, and toggle gzip compression for faster transfers.
  4. 4
    Add location blocksDefine locations for proxying to a backend, serving a SPA with try_files, static assets with cache durations, or redirects.
  5. 5
    Copy the configClick Copy Config and paste the result into your nginx sites-available file, then test it with nginx -t before reloading.

Frequently Asked Questions

Use the Reverse Proxy template: it creates a location block with proxy_pass pointing at your app's local port, plus the proxy headers (Host, X-Real-IP, X-Forwarded-For) your backend needs to see real client information.

Single-page apps handle routing in the browser, so nginx must send unknown paths to index.html. The SPA template adds try_files $uri $uri/ /index.html; which fixes refresh-404s while still serving real files directly.

Run nginx -t (or sudo nginx -t) on your server — it validates syntax without touching the running service. If it passes, apply with sudo systemctl reload nginx, which reloads gracefully without dropping connections.

Yes. Enable SSL and provide your certificate and key paths (for Let's Encrypt these live under /etc/letsencrypt/live/yourdomain/). The SSL Redirect template also generates the port-80 block that forwards all HTTP traffic to HTTPS.

On Debian/Ubuntu, save it as /etc/nginx/sites-available/yourdomain and symlink it into sites-enabled. On other distributions, place it in /etc/nginx/conf.d/ with a .conf extension.

Related Tools

.htaccess GeneratorDocker Compose BuilderHTTP Header Explorer