Back to tools
⚙️DevOps
Nginx Config Generator
Generate production-ready Nginx configs for static sites, reverse proxies, PHP-FPM, and SPAs with SSL and security headers.
Preset Templates
Server Settings
SSL / TLS
Features
GZIP Compression
Security Headers
CORS Headers
Rate Limiting
Cache Static Assets
WebSocket Support
server {
listen 80;
listen [::]:80;
# Server name
server_name example.com;
# Document root
root /var/www/html;
index index.html index.htm;
# Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Client body size
client_max_body_size 10m;
# GZIP compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
# Default location
location / {
try_files $uri $uri/ =404;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, immutable";
access_log off;
}
}