generated from fahricansecer/boilerplate-fe
All checks were successful
HarunCAN Studio FE Deploy 🎨 / build-and-deploy (push) Successful in 14s
46 lines
1.3 KiB
Nginx Configuration File
46 lines
1.3 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name _;
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
# Gzip sıkıştırma
|
||
gzip on;
|
||
gzip_types text/plain text/css application/json application/javascript text/xml;
|
||
|
||
# SPA routing — tüm yolları index.html'e yönlendir
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
# API Proxy — resolver sayesinde backend kapalıyken de nginx başlar
|
||
location /api {
|
||
resolver 127.0.0.11 valid=30s ipv6=off;
|
||
set $backend "backend-container:3000";
|
||
proxy_pass http://$backend;
|
||
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;
|
||
}
|
||
|
||
# Uploads Proxy
|
||
location /uploads {
|
||
resolver 127.0.0.11 valid=30s ipv6=off;
|
||
set $backend "backend-container:3000";
|
||
proxy_pass http://$backend;
|
||
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;
|
||
}
|
||
|
||
# Statik dosya cache (JS, CSS, images, fonts)
|
||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
}
|