HomeNginx Config Generator

Nginx Config Generator

Online Nginx configuration generator supporting reverse proxy, load balancing, SSL/TLS and other common scenarios

Basic Configuration

Reverse Proxy

SSL/TLS

Load Balancing

Generated Configuration

server {
    listen 80;
    listen [::]:80;
    server_name example.com;

    # 网站根目录
    root /var/www/html;
    index index.html index.htm index.php;

    # 主要位置配置
    location / {
        try_files $uri $uri/ =404;
    }

    # 静态文件缓存
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg)$ {
        expires 1y;
        add_header Cache-Control "public, immutable";
    }

    # 安全头
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Content-Type-Options "nosniff" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header X-XSS-Protection "1; mode=block" always;
}

Configuration Templates



Documentation

What is Nginx Config Generator

This tool generates common Nginx configuration snippets online for static sites, reverse proxy, SSL, and load balancing use cases.

Key Features

  • Build base server config (domain, port, root path).
  • Enable reverse proxy and set backend target quickly.
  • Turn on SSL with certificate and key paths.
  • Load presets and export the generated nginx.conf.

Steps

  1. Fill in base options (domain, port, root).
  2. Enable proxy, SSL, or load balancing as needed.
  3. Preview generated config in the result panel.
  4. Copy or download config for deployment.

FAQ

Why do proxy and load balancing show a conflict warning?

The generator prioritizes proxy mode when both are enabled. Keep only one forwarding strategy based on your architecture.

Can I use the generated config in production directly?

Run nginx -t in a test environment first, then adjust paths, permissions, TLS files, and upstream health-check rules for your server.