server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;

    root /usr/share/nginx/html;
    index index.html;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    keepalive_requests 1000;
    etag on;
    if_modified_since exact;

    gzip on;
    gzip_vary on;
    gzip_min_length 1024;
    gzip_comp_level 5;
    gzip_proxied any;
    gzip_types image/svg+xml text/plain text/css application/javascript application/json application/xml;

    open_file_cache max=1000 inactive=30s;
    open_file_cache_valid 60s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;

    location ~* \.(?:avif|webp|svg|png|jpe?g|gif|ico|bmp)$ {
        access_log off;
        log_not_found off;
        expires 30d;
        add_header Cache-Control "public, max-age=2592000, immutable";
        try_files $uri =404;
    }

    location / {
        try_files $uri $uri/ =404;
    }

    location = /50x.html {
        internal;
    }

    error_page 500 502 503 504 /50x.html;
}
