2026-01-18 18:57:06 +04:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name dexarmarket.ru www.dexarmarket.ru;
|
|
|
|
|
|
|
|
|
|
root /var/www/dexarmarket/browser;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# Angular routing - serve index.html for all routes
|
|
|
|
|
location / {
|
2026-07-14 12:22:21 +04:00
|
|
|
try_files $uri $uri/ /index.html;
|
2026-01-18 18:57:06 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 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 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;
|
|
|
|
|
gzip_min_length 1000;
|
|
|
|
|
|
|
|
|
|
# Security headers
|
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
|
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
|
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
2026-03-06 18:40:58 +04:00
|
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://telegram.org; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https:; frame-src https://telegram.org;" always;
|
2026-01-18 18:57:06 +04:00
|
|
|
|
|
|
|
|
# Brotli compression (if available)
|
|
|
|
|
# brotli on;
|
|
|
|
|
# brotli_comp_level 6;
|
|
|
|
|
# brotli_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
|
|
|
|
|
}
|
2026-05-19 02:57:19 +04:00
|
|
|
|
|
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name lovero.store www.lovero.store;
|
|
|
|
|
|
2026-07-02 02:22:06 +04:00
|
|
|
root /var/www/loveromarket/browser;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# Angular routing
|
2026-05-19 02:57:19 +04:00
|
|
|
location / {
|
2026-07-14 12:22:21 +04:00
|
|
|
try_files $uri $uri/ /index.html;
|
2026-07-02 02:22:06 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Proxy API calls to backend
|
|
|
|
|
location /api {
|
|
|
|
|
proxy_pass https://api.lovero.store:555;
|
|
|
|
|
proxy_set_header Host api.lovero.store;
|
2026-05-19 02:57:19 +04:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2026-07-13 16:44:34 +04:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Template for onboarding a new marketplace tenant.
|
|
|
|
|
# Replace NEWMARKETPLACE.EXAMPLE.COM, /var/www/newmarketplace, and the
|
|
|
|
|
# api.newmarketplace.example.com:443 proxy target with the real values,
|
|
|
|
|
# then rename this block's server_name/root before deploying.
|
2026-07-14 12:22:21 +04:00
|
|
|
#
|
|
|
|
|
# --- SPA routing (read before you skip this) ---
|
|
|
|
|
# This is an Angular app with client-side routing (all page navigation - the
|
|
|
|
|
# admin dashboard, project editor, catalog, product pages, etc. - happens in
|
|
|
|
|
# the browser, not via new server requests). Every URL the app owns
|
|
|
|
|
# (/:lang/backoffice/dashboard, /:lang/edit/general, /:lang/catalog/5, ...)
|
|
|
|
|
# must fall through to index.html on a fresh request (page refresh, typed
|
|
|
|
|
# URL, browser back/forward after a full reload) so Angular's router can take
|
|
|
|
|
# over client-side. `try_files $uri $uri/ /index.html;` below is what makes
|
|
|
|
|
# that work: nginx tries the literal file, then the directory, then falls
|
|
|
|
|
# back to index.html for anything that isn't a real static asset. If you ever
|
|
|
|
|
# see a raw nginx 404 page on refresh/back-navigation (not a blank app, an
|
|
|
|
|
# actual nginx error page), this fallback is missing or misconfigured for
|
|
|
|
|
# that server block - it is NOT an Angular or JS problem.
|
|
|
|
|
#
|
|
|
|
|
# --- Two ways the frontend talks to its API - pick one per tenant ---
|
|
|
|
|
# 1) Proxied (what this template and the lovero.store block above do):
|
|
|
|
|
# the frontend calls a relative `/api/...` path, and nginx proxies it to
|
|
|
|
|
# the real backend below. Browser never sees the backend host/port.
|
|
|
|
|
# 2) Direct (what the dexarmarket.ru production build does): the frontend's
|
|
|
|
|
# `environment.production.ts` sets `apiUrl`/`authApiUrl` to an absolute
|
|
|
|
|
# URL (e.g. `https://api.dexarmarket.ru:445`) and calls that directly -
|
|
|
|
|
# this nginx config is never involved in API calls at all for that tenant.
|
|
|
|
|
# If a tenant using pattern (2) reports 502/504 Bad Gateway on refresh or
|
|
|
|
|
# back-navigation, it is NOT this file - the app re-fires session-check and
|
|
|
|
|
# bootstrap-load calls on every route change/refresh, and a 502/504 means the
|
|
|
|
|
# *backend's own* reverse proxy/app server (the one fronting that absolute
|
|
|
|
|
# apiUrl/authApiUrl host) is down, overloaded, or timing out. Check that
|
|
|
|
|
# backend's own nginx/app logs, not this one.
|
2026-07-13 16:44:34 +04:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name newmarketplace.example.com www.newmarketplace.example.com;
|
|
|
|
|
|
|
|
|
|
root /var/www/newmarketplace/browser;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# Angular routing - serve index.html for all routes (client-side router
|
|
|
|
|
# handles /edit, /:lang/edit/:section, etc. once index.html is served)
|
|
|
|
|
location / {
|
2026-07-14 12:22:21 +04:00
|
|
|
try_files $uri $uri/ /index.html;
|
2026-07-13 16:44:34 +04:00
|
|
|
}
|
|
|
|
|
|
2026-07-14 12:22:21 +04:00
|
|
|
# Proxy API calls to backend - only needed if this tenant uses the
|
|
|
|
|
# relative `/api` pattern (see comment above); delete this block if the
|
|
|
|
|
# tenant's environment.*.ts uses an absolute apiUrl instead.
|
2026-07-13 16:44:34 +04:00
|
|
|
location /api {
|
|
|
|
|
proxy_pass https://api.newmarketplace.example.com:443;
|
|
|
|
|
proxy_set_header Host api.newmarketplace.example.com;
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2026-07-02 02:22:06 +04:00
|
|
|
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;
|
2026-05-19 02:57:19 +04:00
|
|
|
}
|
2026-07-02 02:22:06 +04:00
|
|
|
|
|
|
|
|
# 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;
|
2026-05-19 02:57:19 +04:00
|
|
|
}
|