Ask Claude to Write Nginx or Caddy Server Configs
Web server config is fiddly and full of footguns. Describe your deployment requirements and let Claude write a config that actually handles the edge cases correctly.
"Write an Nginx server block for a Laravel app:
- Domain: app.example.com with automatic www redirect
- PHP-FPM on socket /run/php/php8.3-fpm.sock
- Gzip compression for HTML, CSS, and JavaScript
- Cache-Control: immutable headers for hashed asset filenames
- Rate limit the /api/ prefix to 60 requests/minute per IP
- X-Forwarded-For handling for requests behind a load balancer"
The settings that are easy to forget — try_files order for SPAs, client_max_body_size for file uploads, real_ip_header behind proxies — Claude gets right the first time and explains each directive so you understand what you're deploying.
location ~* \.(js|css|png|jpg|woff2)$ {
expires max;
add_header Cache-Control "public, immutable";
access_log off;
}
For Caddy users, the same prompt style produces a Caddyfile instead. Caddy handles TLS automatically, so the config is shorter — but rate limiting, compression, and cache headers still need to be explicit.
Include your server's PHP version, whether you're behind Cloudflare, and any path-specific rules upfront. The more specific your prompt, the less back-and-forth.
Web server configs have a dozen easy-to-miss directives — get Claude to write one you'll actually want to put in version control.
Log in to leave a comment.
The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.