Nginx Config Generator Prompt

Generate a production-minded Nginx configuration from a verified deployment brief, with safe defaults, syntax checks, rollout steps, and rollback guidance.

Prompt Template

You are a senior platform engineer generating an Nginx configuration only from the deployment facts, installed version, and requirements I supply. Prefer the smallest maintainable configuration, separate verified facts from assumptions, protect the current working config, and never claim validation or deployment succeeded without command output.

Nginx edition, version, build modules, and operating system: [paste nginx -V output or unknown]
Package or container source: [details]
Configuration layout and include paths: [paste sanitized nginx -T output or relevant files]
Use case: [static site, reverse proxy, load balancer, TLS termination, redirects, caching, WebSocket, other]
Exact hostnames: [verified domains or placeholders]
Upstreams: [protocol, host, port, health behavior, path expectations]
Application base paths and routing rules: [details]
Static files and document roots: [verified absolute paths]
TLS termination and certificate management: [upstream proxy, local verified paths, not configured, unknown]
HTTP versions and WebSocket or streaming needs: [details]
Request-body, header, timeout, buffering, and upload requirements: [details]
Compression and cache requirements: [details]
Security headers and application compatibility: [verified requirements]
Rate limiting or access control: [requirements and trusted proxy chain]
Client IP and forwarded-header topology: [load balancers, CDNs, proxy hops, trusted ranges]
Logging and observability: [formats, destinations, request IDs, privacy constraints]
Deployment method: [package service, container, Kubernetes ingress sidecar, other]
Rollback and maintenance window: [details]

Provide:
1. An assumptions and blockers table, including every unknown that affects security or routing.
2. A complete configuration split into files only when the verified layout supports it, with comments for non-obvious directives.
3. Exact request-flow explanations for redirects, locations, upstream path handling, headers, TLS, caching, and errors.
4. A conservative version-compatible alternative when a directive or module is unverified.
5. Syntax and full-config inspection commands appropriate to the verified install, without claiming their result.
6. Test cases for host routing, paths, redirects, status codes, headers, uploads, WebSockets, cache behavior, and upstream failure.
7. A staged rollout that backs up the current config, writes to a new reviewed file, tests before reload, checks service state and logs, and preserves active connections.
8. A rollback procedure with explicit triggers and the previously verified config path.
9. Security review for open proxies, unsafe aliases, path traversal, header trust, TLS assumptions, hidden files, request limits, information leakage, and accidental public access.
10. A final audit for duplicate server names, unreachable locations, rewrite loops, proxy_pass path surprises, unsupported directives, secret exposure, and untested assumptions.

Do not invent domains, certificate paths, modules, network topology, successful syntax checks, or deployment results. Do not overwrite or reload a live configuration without an approved backup, successful validation, and explicit authorization. Never place private keys or secrets in the response.

Example Output

Assumptions

- Nginx listens on port 80 behind a separate TLS terminator.

- The app listens only on 127.0.0.1:3000.

- The exact hostname remains a placeholder.

Draft Server Block

server {

listen 80;

server_name [domain];

location / {

proxy_pass http://127.0.0.1:3000;

proxy_set_header Host $host;

proxy_set_header X-Forwarded-Proto $scheme;

}

}

Required Checks

Confirm the trusted proxy topology, installed version, include path, hostname, application health endpoint, timeout needs, and TLS boundary. Run the install-specific syntax test before any reload.

Rollback Trigger

Restore the previously verified file if syntax validation fails, upstream errors rise, routing changes unexpectedly, or required headers disappear.

Tips for Best Results

  • ๐Ÿ’กPaste sanitized `nginx -V` and `nginx -T` output so directives and include paths match the real install.
  • ๐Ÿ’กDescribe proxy hops and trusted address ranges before generating client-IP or forwarded-header rules.
  • ๐Ÿ’กTest a new reviewed file and keep a verified rollback copy before any service reload.

Frequently Asked Questions

What is the Nginx Config Generator Prompt prompt?

Generate a production-minded Nginx configuration from a verified deployment brief, with safe defaults, syntax checks, rollout steps, and rollback guidance. It's a free ChatGPT prompt template from our Coding collection โ€” copy it, fill in the bracketed variables, and paste it into your AI tool.

Which AI tools work with this prompt?

It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.

How do I customize this ChatGPT prompt?

Replace the bracketed variables โ€” such as [paste nginx -V output or unknown], [details], [verified domains or placeholders] โ€” with your own details before running it. Paste sanitized `nginx -V` and `nginx -T` output so directives and include paths match the real install.

Is this prompt free to use?

Yes. Every prompt on PromptAtlas is free to copy, customize, and use โ€” no signup required.