Nginx-Konfigurationsgenerator

Erstellen Sie produktionsreife Nginx-Konfigurationen — statische Websites, SPAs, Reverse-Proxys und PHP-Anwendungen

Servertyp
nginx.conf
server {
    listen 80;
    server_name example.com;

    client_max_body_size 10m;

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

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

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

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

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

    location ~ /\. {
        deny all;
    }
}

Nginx-Konfigurationsgenerator

Erstellen Sie produktionsreife Nginx-Konfigurationen — statische Websites, SPAs, Reverse-Proxys und PHP-Anwendungen

Funktionen

  • Static site, SPA, reverse proxy, or PHP server presets
  • TLS / HTTPS redirect block with Let's Encrypt-friendly defaults
  • Gzip compression + browser-cache headers for static assets
  • Security headers (X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy)
  • Optional rate limiting with `limit_req_zone` hint + per-location `limit_req`

Anleitung

  1. Wählen Sie Ihren Servertyp (statisch, SPA, Reverse-Proxy oder PHP).
  2. Geben Sie Ihren Domainnamen ein und konfigurieren Sie die Pfade.
  3. Aktivieren Sie Funktionen wie SSL, gzip, Caching und Sicherheits-Header.
  4. Kopieren Sie die generierte Konfiguration und speichern Sie sie auf Ihrem Server.

Tipps & Best Practices

  • `limit_req_zone` MUST live in the `http {}` block, not inside `server {}`. The generator emits a comment showing where to put it.
  • Test the config with `nginx -t` before reloading. The output is template-grade; expect to tune for your specific environment.
  • For Let's Encrypt, run certbot once to fetch certs; the paths in the generated config (`/etc/letsencrypt/live/<domain>/`) are the standard locations.
  • Reverse-proxy mode forwards to `proxy_pass http://localhost:3000` — adjust the upstream URL for your backend.
  • For multi-domain configs, generate per-domain server blocks and concatenate them in `/etc/nginx/sites-available/`.

FAQ

Was ist der Unterschied zwischen dem Static- und dem SPA-Modus?

Der Static-Modus liefert 404 für unbekannte Pfade. Der SPA-Modus leitet alle Pfade zu index.html um und ermöglicht so clientseitiges Routing (React, Angular, Vue).

Sollte ich gzip aktivieren?

Ja, die gzip-Komprimierung reduziert die Dateigröße um 60–80 % und verbessert die Ladezeiten von Seiten erheblich.

Wie richte ich SSL ein?

Aktivieren Sie SSL, geben Sie die Pfade zu Ihrem Zertifikat und Schlüssel an, und der Generator erstellt automatisch einen Weiterleitungsblock von HTTP zu HTTPS.