NGINX config generator
Pick what you serve and where it runs, then adjust HTTPS, caching and security. You get a complete nginx.conf for NGINX 1.30.5, with a comment on every non-default setting. Everything runs in your browser.
ServingWhat are you serving?
Runs onWhere does it run?
What each option does
The same text appears as tooltips in the builder. Some options only apply to certain profiles.
Site
- Domain name
- NGINX picks this site by the Host name in each request. Requests for any other name are closed without an answer. Docs
- www redirect
- Search engines and cookies treat www.example.com and example.com as different sites. A permanent redirect keeps one address. With HTTPS the certificate must cover both names. Docs
- Files folder
- This is the root of your site on disk. The NGINX user needs read access to it. Docs
- Backend servers
- NGINX forwards dynamic requests to these servers. With two or more, a failed server is skipped for a while. A backup server only gets traffic when the others are down. Docs
HTTPS
- HTTPS
- Browsers mark plain HTTP as not secure and HTTP/2 needs TLS. Use your own certificate files, or let the NGINX ACME module get one from Let’s Encrypt. Docs
- Certificate file
- Clients need the intermediate certificates to trust yours. certbot calls this file fullchain.pem. Docs
- Private key file
- Keep this file readable only by root. NGINX reads it at start while it still runs as root. Docs
- Contact email
- The ACME account needs a contact address. NGINX also accepts the Let’s Encrypt terms of service for you. Docs
- Use the staging server
- The production server limits failed attempts. Use staging until issuing works, then turn this off. Docs
- TLS policy
- Intermediate follows the Mozilla guideline and works with nearly every client. Modern allows only TLS 1.3 and is stricter. Docs
- HSTS
- After the first visit the browser refuses plain HTTP for 2 years. Preload adds the domain to lists shipped inside browsers, and removal takes months. Docs
- HTTP/3 (QUIC)Experimental
- HTTP/3 can load pages faster on bad networks. NGINX still marks the module experimental. You must open the HTTPS port for UDP too. Docs
Performance
- Compress responses (gzip)
- Text, JSON, and SVG compress well. For pages that change per user, compression can leak secrets (BREACH), so it is off by default for PHP and proxy. Docs
- gzip level
- Level 1 is the NGINX default and gets most of the gain. Raise it only after you measure CPU use. Docs
- Serve prebuilt .gz files
- Your build compresses files once, so NGINX spends no CPU per request. The .gz file must have the same modification time as the original. Without a .gz file this costs one extra file lookup. Docs
- Cache forever under these paths
- Files like /assets/app-3f9a1c.js change name when they change, so browsers can keep them for a year. Only list folders where every name has a hash. Each path starts and ends with /. Docs
- Cache open files
- Saves file system lookups on busy sites with many small files. Changed files can show up to 30 seconds late. Docs
- Cache public responses
- Repeat requests are answered by NGINX without asking the backend. Requests with cookies or Authorization, and responses with Set-Cookie, private, or no-store, are never cached. Docs
- Cache public PHP responses
- Repeat requests skip PHP. Requests with cookies or Authorization, and responses with Set-Cookie, private, or no-store, are never cached. Check your app before you enable this. Docs
- Buffer access log writes
- Fewer writes help on busy servers. A crash can lose the last few seconds of log lines. Docs
Security
- Largest upload
- Bigger requests get status 413. NGINX does not allow turning this check off here, because unlimited uploads can fill your disk. Docs
- Clickjacking protection
- Other sites can hide your page in a frame and trick users into clicking. This sends X-Frame-Options and the matching frame-ancestors rule. Docs
- Content-Security-Policy
- A policy limits where scripts and styles can load from. A wrong policy breaks your site, so test it in report-only mode first. Docs
- Report only
- Lets you see what a policy would break before you enforce it. The frame-ancestors rule is still enforced. Docs
- Turn off powerful browser features
- Your pages and any embedded frames cannot ask for these features. Turn it off if your site needs one of them. Docs
- Cross-Origin-Opener-Policy
- Protects against some cross-window attacks. The strict value breaks sign-in and payment popups. Docs
- Rate limit
- Slows down password guessing and scraping. Static files are not counted. Behind a CDN, also set the real client IP, or all users share one limit. Docs
- Requests per second
- Requests above this rate wait or fail, depending on the burst size. Docs
- Burst size
- Pages often send several requests together. A burst lets them through without delay. Docs
- Connections per client IP
- Stops one client from holding many connections. With HTTP/2 and HTTP/3, each running request counts as a connection. Docs
- Behind a CDN or load balancer?
- Without this, logs and rate limits see the proxy address, not the visitor. NGINX only trusts the header from the proxy ranges you list. Docs
- Trusted proxy addresses
- Only these addresses may tell NGINX the client IP and the original scheme. Trusting too much lets anyone fake their IP. Docs
- Client IP header
- Use the header your proxy really sets. PROXY protocol sends the IP before the HTTP request and needs proxy support. Docs
Proxy and PHP
- Balancing method
- Round robin takes turns. Least connections prefers the least busy server. The hash method keeps the same client on the same server. Docs
- WebSocket path
- Only this path gets WebSocket headers and long timeouts. Other requests keep normal connection reuse to the backend. Docs
- Streaming path
- Turns off response buffering for this path only, so events arrive at once. Your app can also send the X-Accel-Buffering: no header instead. Docs
- Backend read timeout
- The NGINX default is 60 seconds. Raise it only for slow endpoints, because a stuck request holds a connection that long. Docs
- Backend uses HTTPS
- Protects traffic between NGINX and a backend on another machine. NGINX does not check backend certificates unless asked, so this turns checking on. Docs
- Backend certificate name
- NGINX sends it as SNI and checks the certificate against it. Without a name, a certificate for any host would pass. Docs
Advanced
- HTTP listen port
- Ports below 1024 need root. A non-root container must use a high port and publish it as 80. Docs
- HTTPS listen port
- Used for TLS and for HTTP/3 over UDP. Must differ from the HTTP port. Docs
- Public HTTP port
- In a container, 8080 is published as 80. NGINX needs the public number to build correct redirects and forwarded headers. Docs
- Public HTTPS port
- Used in redirects, X-Forwarded-Port, and the HTTP/3 Alt-Svc header. A wrong value sends visitors to a closed port. Docs
- Listen on IPv6
- NGINX fails to start if the host has IPv6 turned off. Containers usually have no IPv6, so this is off for containers. Docs
- Connections per worker
- Every connection uses a file descriptor. The file limit must be at least this high, and the proxy uses two descriptors per request. Docs
- Worker user
- Workers should not run as root. Debian and Ubuntu packages use www-data, the nginx.org packages use nginx. Docs
- DNS resolver
- NGINX needs a resolver to look up backend host names while it runs, and for the ACME module. 127.0.0.11 is the Docker DNS, 127.0.0.53 is systemd-resolved. Docs
- Status page on localhost
- Shows connection counts for monitoring tools. It listens on loopback only, so it is not reachable from outside. Docs
Questions
- Is my configuration sent to a server?
- No. The page runs entirely in your browser. Share links keep your options in the part of the URL after #, which browsers do not send to servers.
- Which NGINX version is the output written for?
- NGINX 1.30.5, the current stable release. Every directive is checked with nginx -t in the matching container image.
- Server or container: what changes?
- A server config uses ports 80 and 443, writes logs to /var/log/nginx and runs as the nginx user. A container config uses ports 8080 and 8443, keeps temporary files in /tmp and logs to stdout and stderr, so it runs without root.
- Does the generator issue certificates?
- It can configure the NGINX ACME module for Let’s Encrypt, or point to certificate files you already have. Port 80 must stay reachable for the ACME HTTP-01 challenge.
Want the reasoning behind the defaults? Read the guides.