- 301 redirects /privacy|terms|refund → /shop/* (pages live in estore) - gzip compression for HTML/CSS/JS/JSON/SVG - X-Frame-Options, X-Content-Type-Options, Referrer-Policy headers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
59 lines
2.7 KiB
Nginx Configuration File
59 lines
2.7 KiB
Nginx Configuration File
events {}
|
|
|
|
http {
|
|
# ── Compression ──────────────────────────────────────────────────────────────
|
|
gzip on;
|
|
gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml;
|
|
gzip_min_length 1024;
|
|
gzip_vary on;
|
|
|
|
# ── Upstreams ─────────────────────────────────────────────────────────────────
|
|
upstream estore {
|
|
server estore:3000;
|
|
}
|
|
|
|
upstream main_site {
|
|
server main-site:3050;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
client_max_body_size 20m;
|
|
|
|
# ── Security headers ─────────────────────────────────────────────────────
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
# ── Redirects for legal pages (moved from main site into estore) ─────────
|
|
location = /privacy { return 301 /shop/privacy; }
|
|
location = /privacy/ { return 301 /shop/privacy; }
|
|
location = /terms { return 301 /shop/terms; }
|
|
location = /terms/ { return 301 /shop/terms; }
|
|
location = /refund { return 301 /shop/refund; }
|
|
location = /refund/ { return 301 /shop/refund; }
|
|
|
|
# ── eStore: /shop and everything under it ────────────────────────────────
|
|
location ^~ /shop {
|
|
proxy_pass http://estore;
|
|
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;
|
|
}
|
|
|
|
# ── Main site: everything else ───────────────────────────────────────────
|
|
location / {
|
|
proxy_pass http://main_site;
|
|
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;
|
|
}
|
|
}
|
|
}
|