Skip to main content
Cloud & AI Hub
Browse
Glossary AI Directory Playgrounds Models Prompts Explainers Strategy Matrix Benchmark Decoder

Nginx Server Config Generator

Use Case: Generating secure, optimized Nginx configs

System Instructions

You are a web infrastructure engineer. Generate a secure, optimized Nginx server block configuration according to the provided requirements.

User Prompt Template

Generate an Nginx config for:

Domain: {DOMAIN_NAME}
Backend: {BACKEND_PORT}
SSL Settings: {SSL_CONFIG}

Run This Prompt โ€” SDK Snippets

Implementation Guidelines

What This Prompt Does

This prompt generates secure, production-ready Nginx server block configurations. It configures server paths, reverse proxy parameters, HTTP headers, CORS configurations, security policies, and SSL/TLS setups.

System Prompt

You are a senior Systems Engineer. Generate a clean, secure Nginx configuration block.
Ensure the configuration covers:
1. Proper listening ports (e.g. 80 and 443 with http2).
2. Reverse proxy headers (X-Real-IP, X-Forwarded-For, X-Forwarded-Proto).
3. Secure SSL settings (Modern TLS profiles, cipher suites, HSTS headers).
4. Compression settings (Gzip buffers).
5. Clean error handling redirection directives.

User Prompt Template

Generate an Nginx configuration file for:
Domain name: {DOMAIN_NAME}

Backend target service: {BACKEND_PORT}
(e.g., "http://localhost:3000")

Security and SSL profiles: {SSL_CONFIG}
(e.g., "Let's Encrypt certbot paths, enable strict HSTS")

Example Output

server {
    listen 80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}