75 lines
2.5 KiB
Plaintext
75 lines
2.5 KiB
Plaintext
|
|
# quiXzoom Shop — Nginx reverse proxy
|
||
|
|
|
||
|
|
# Redirect HTTP to HTTPS
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name shop.quixzoom.com;
|
||
|
|
return 301 https://$server_name$request_uri;
|
||
|
|
}
|
||
|
|
|
||
|
|
# HTTPS
|
||
|
|
server {
|
||
|
|
listen 443 ssl http2;
|
||
|
|
server_name shop.quixzoom.com;
|
||
|
|
|
||
|
|
# SSL certificates (Let's Encrypt or similar)
|
||
|
|
ssl_certificate /etc/letsencrypt/live/quixzoom.com/fullchain.pem;
|
||
|
|
ssl_certificate_key /etc/letsencrypt/live/quixzoom.com/privkey.pem;
|
||
|
|
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;
|
||
|
|
ssl_session_cache shared:SSL:10m;
|
||
|
|
ssl_session_timeout 10m;
|
||
|
|
|
||
|
|
# 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;
|
||
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||
|
|
|
||
|
|
# CORS for API
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://localhost:8087;
|
||
|
|
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;
|
||
|
|
|
||
|
|
add_header Access-Control-Allow-Origin "https://quixzoom.com" always;
|
||
|
|
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
|
||
|
|
add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
|
||
|
|
|
||
|
|
if ($request_method = OPTIONS) {
|
||
|
|
return 204;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
# Webhook endpoint (no CORS)
|
||
|
|
location /api/payment/webhook {
|
||
|
|
proxy_pass http://localhost:8087;
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Static and pages
|
||
|
|
location / {
|
||
|
|
proxy_pass http://localhost:8087;
|
||
|
|
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;
|
||
|
|
|
||
|
|
# Cache static assets
|
||
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||
|
|
proxy_pass http://localhost:8087;
|
||
|
|
expires 1y;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|