Files
aramesh-backend/frontend/nginx.conf
T

35 lines
1018 B
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# مسیریابی SPA — همه مسیرها به index.html برمی‌گردند
location / {
try_files $uri $uri/ /index.html;
}
# پروکسی درخواست‌های API به سرویس بک‌اند
location /api/ {
proxy_pass http://backend:8000;
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;
}
# تصاویر: بدون کش طولانی — تا تغییرات سریع دیده شوند
location ~* ^/images/ {
add_header Cache-Control "no-cache";
try_files $uri =404;
}
# کش استاتیک
location ~* \.(js|css|png|jpg|jpeg|gif|svg|webp|ico|woff2?)$ {
expires 30d;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
}