# mail.ru - Generated by NginxForge # Preset: Node.js # Generated: 2026-01-20 21:11:50 UTC upstream mail_ru_backend { server 127.0.0.1:3000; keepalive 64; } # HTTP -> HTTPS redirect server { listen 80; listen [::]:80; server_name mail.ru www.mail.ru; location /.well-known/acme-challenge/ { root /var/www/certbot; allow all; } location / { return 301 https://$host$request_uri; } } server { listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate /etc/letsencrypt/live/mail.ru/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mail.ru/privkey.pem; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; server_name mail.ru www.mail.ru; root /var/www/mail.ru; index index.html index.htm; server_tokens off; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Content-Security-Policy "upgrade-insecure-requests" always; # Allowed methods if ($request_method !~ ^(GET|POST|HEAD)$) { return 405; } # Gzip compression gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_min_length 1000; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/xml; client_max_body_size 64m; # Node.js application configuration location / { proxy_pass http://mail_ru_backend; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; } # Static assets location ~ ^/(assets|dist|public)/ { root /var/www/mail.ru; expires 30d; add_header Cache-Control "public, immutable"; try_files $uri =404; } # Static file caching location ~* \.(jpg|jpeg|png|gif|ico|webp|svg|woff|woff2|ttf|eot|otf)$ { expires 30d; add_header Cache-Control "public, immutable"; access_log off; log_not_found off; } location ~* \.(css|js)$ { expires 30d; add_header Cache-Control "public, immutable"; access_log off; } location ~* \.(pdf|doc|docx|xls|xlsx|zip|rar|gz|tar)$ { expires 7d; add_header Cache-Control "public"; } # Deny access to hidden files location ~ /\. { deny all; access_log off; log_not_found off; } access_log /var/log/nginx/mail.ru.access.log; error_log /var/log/nginx/mail.ru.error.log; }