🎯 Preset
Choose a curated starting point. Form fields below repopulate when you switch presets.
🏷️ Server identification
🔒 TLS / SSL
↪️ Reverse proxy
🐘 PHP-FPM
📁 Static files
🛡️ Security headers
🗜️ Compression
⚠️ Custom error pages
📋 Logging
📤 Generated configuration
{{ currentOutput || '# Configure options on the left to generate.' }}
⚠️ Warnings
- {{ w }}
📂 Explanation
- {{ e.section }} — {{ e.meaning }}
ℹ️ About Apache / Nginx / Caddy Config Generator
What this generator builds
Three parallel server configurations from a single form: an
Apache 2.4 <VirtualHost> block, an nginx
server { } block, and a Caddy 2 Caddyfile snippet.
Toggle TLS, HSTS, reverse-proxy upstream, PHP-FPM dispatch, static
file serving, gzip, security headers, custom error pages, and
logging paths, and every change rewrites all three outputs in
real time.
The intent is to compare equivalent directives side-by-side
(ProxyPass vs. proxy_pass vs.
reverse_proxy; SSLEngine on vs.
listen 443 ssl vs. Caddy's auto-HTTPS), and to
produce a deployable starting point that already wraps headers
in the right <IfModule> / location
/ Caddy block syntax.
Sections this generator can emit
- TLS termination — Apache
SSLEngine on+SSLCertificateFile, nginxlisten 443 ssl http2+ssl_certificate, Caddytlsdirective (or automatic Let's Encrypt for public hostnames). - HTTP → HTTPS redirect — a second VirtualHost / server block on port 80 issues a permanent 301 to the HTTPS equivalent. Pair with HSTS for downgrade resistance.
- HSTS —
Strict-Transport-Security: max-age=...pins the host to HTTPS for the configured duration (RFC 6797). - Reverse proxy — Apache
ProxyPass/ProxyPassReverse, nginxproxy_pass, Caddyreverse_proxy. Optional WebSocket upgrade preserves theUpgradeandConnectionheaders. - PHP-FPM via FastCGI — Apache uses
mod_proxy_fcgiwith aSetHandler "proxy:unix:..."directive; nginx usesfastcgi_passagainst a Unix socket or TCP endpoint. - Static files + indexes —
DirectoryIndex(Apache),index(nginx),file_server(Caddy), with optionalexpiresfor browser caching. - gzip compression —
mod_deflatefilter (Apache),gzip on; gzip_types ...(nginx),encode gzip(Caddy). - Security headers — Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy.
- Server header hiding — Apache
Header unset Server, nginxserver_tokens off, Caddy-Server. - Custom error pages —
ErrorDocument(Apache),error_page(nginx),handle_errors(Caddy). - Access / error logs —
CustomLog+ErrorLog(Apache),access_log+error_log(nginx), Caddylogblock.
Common pitfalls
- HSTS without redirect — declaring
Strict-Transport-Securityon the HTTPS vhost without also 301-redirecting plain HTTP leaves the first request unprotected. Enable "Redirect HTTP to HTTPS" alongside HSTS. - TLS 1.0 / 1.1 — formally deprecated by
RFC 8996
(March 2021). Keep only
TLSv1.2andTLSv1.3. - Reverse proxy and Host header — without
ProxyPreserveHost On(Apache) orproxy_set_header Host $host(nginx) the upstream sees the proxy host, which breaks vhost-based apps (Express, FastAPI, Laravel host detection). - WebSocket without Upgrade headers — Apache needs
mod_proxy_wstunnel+ aRewriteRuleonHTTP:Upgrade=websocket; nginx needsproxy_set_header Upgrade $http_upgrade+Connection "upgrade". Caddy handles this automatically. - PHP-FPM via TCP vs. Unix socket — Unix sockets are faster on a single host but require correct file permissions. TCP is mandatory when PHP-FPM runs on a separate host or container.
Source references
- Apache 2.4 VirtualHost documentation — name-based vhost setup.
- Apache 2.4 mod_proxy —
ProxyPass+ProxyPassReversereference. - Apache 2.4 mod_ssl — TLS termination directives.
- nginx admin guide — core directives + module reference.
- nginx ngx_http_proxy_module —
proxy_passand proxy header handling. - Caddyfile concepts — Caddy 2 syntax overview.
- Mozilla SSL Configuration Generator — canonical TLS cipher and protocol baselines.
API Usage Example:
POST /api/tools/linux/web-server-config-generator
Content-Type: application/json
{
"operation": "generate",
"serverName": "example.com",
"ssl": {
"enabled": true,
"certPath": "/etc/letsencrypt/live/example.com/fullchain.pem",
"keyPath": "/etc/letsencrypt/live/example.com/privkey.pem",
"redirectHttp": true,
"hsts": true,
"hstsAge": 31536000,
"tlsVersions": [
"TLSv1.2",
"TLSv1.3"
]
},
"reverseProxy": {
"enabled": true,
"upstreamHost": "127.0.0.1",
"upstreamPort": 3000,
"preserveHostHeader": true
},
"gzip": true
}