From a59ffbcaa415218510ea52f9b39bdc2bca9f113d Mon Sep 17 00:00:00 2001 From: sdarbinyan Date: Thu, 2 Jul 2026 02:22:06 +0400 Subject: [PATCH] nginx --- nginx.conf | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/nginx.conf b/nginx.conf index 89fe54d..95bdf33 100644 --- a/nginx.conf +++ b/nginx.conf @@ -50,10 +50,47 @@ server { listen 80; server_name lovero.store www.lovero.store; + root /var/www/loveromarket/browser; + index index.html; + + # Angular routing location / { - proxy_pass http://127.0.0.1:4202; - proxy_set_header Host $host; + try_files $uri $uri/ /index.html =404; + } + + # Proxy API calls to backend + location /api { + proxy_pass https://api.lovero.store:555; + proxy_set_header Host api.lovero.store; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + rewrite ^/api(/.*)$ $1 break; + proxy_ssl_verify off; } + + # Static assets caching + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } + + # Don't cache index.html + location = /index.html { + add_header Cache-Control "no-cache, no-store, must-revalidate"; + add_header Pragma "no-cache"; + add_header Expires "0"; + } + + 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; + gzip_min_length 1000; + + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Referrer-Policy "strict-origin-when-cross-origin" always; }