48 lines
1.8 KiB
Nginx Configuration File
48 lines
1.8 KiB
Nginx Configuration File
# ════════════════════════════════════════════════════════════
|
|
# مُصادَق (Musadaq) — Frontend Nginx Config
|
|
# ════════════════════════════════════════════════════════════
|
|
|
|
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# ── Security Headers ──────────────────────────────────────
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
add_header X-Content-Type-Options "nosniff";
|
|
|
|
# Gzip Compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
# ── Root Path (SPA Support) ────────────────────────────────
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# ── Proxy /api requests to the backend ──────────────────────
|
|
location /api {
|
|
proxy_pass http://api:3300/api;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
}
|
|
|
|
# Static Assets Caching
|
|
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg)$ {
|
|
expires 6M;
|
|
access_log off;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|