server { listen 80; server_name gidli.ru; return 301 https://$host$request_uri; } server { listen 443 ssl http2; server_name gidli.ru; # SSL certificates (managed by certbot) ssl_certificate /etc/letsencrypt/live/gidli.ru/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/gidli.ru/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # Security headers add_header X-Frame-Allow "tg-embed"; add_header X-Content-Type-Options nosniff; # Proxy API and webhook requests to Express location /api/ { proxy_pass http://127.0.0.1:3000; 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_read_timeout 120s; } # Serve static files (Vite build output) location / { root /root/guidly/dist; try_files $uri $uri/ /index.html; # Cache static assets location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ { expires 30d; add_header Cache-Control "public, immutable"; } } }