Nginx Config Generator

Generate Nginx server block configs for redirects, static sites, reverse proxies and SSL-ready hosts.

static server · 28 lines
server {
    listen 80;
    listen [::]:80;
    server_name example.com;

    # force HTTPS
    if ($scheme = http) {
        return 301 https://$host$request_uri;
    }

    root /var/www/example.com;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ {
        expires 30d;
        add_header Cache-Control "public, immutable";
    }

    gzip on;
    gzip_vary on;
    gzip_min_length 1024;
    gzip_types text/plain text/css application/json application/javascript image/svg+xml;
}

Static mode adds SPA fallback, 30-day immutable asset caching and optional HTTPS/WWW rewrites; proxy mode sets the websocket + forwarding headers apps need. The redirect mode uses $request_uri so query strings survive.

About Nginx Config Generator

Generate Nginx server block configs for redirects, static sites, reverse proxies and SSL-ready hosts.

Nginx Config Generator gives you clean, copy-paste-ready code: paste your source, choose the options, and the formatted output appears instantly.

How to Use Nginx Config Generator

  1. Paste your code, markup or configuration into the editor.
  2. Choose the output format or options offered.
  3. The formatted result updates live.
  4. Copy or download the finished code.

Key Features

  • Clean, consistently formatted output ready to paste.
  • Supports the common formats used in web development.
  • One-click copy and download — no build step required.

Frequently Asked Questions

Can I copy the code generated by Nginx Config Generator?

Yes — every result has a copy button (and often a download option), so the output goes straight into your editor or page.

Is Nginx Config Generator free to use?

Yes. Nginx Config Generator is completely free with unlimited use — no account, download or payment required.

Is my data uploaded to a server?

No. Nginx Config Generator runs entirely in your browser. Your inputs are never sent to our servers or stored anywhere.

Does Nginx Config Generator work on mobile?

Yes. The interface is fully responsive and works in any modern browser on Android, iPhone, tablets and desktops.

Related Code Tools

Browse all 47 Code Tools →