academia/deploy/docker/nginx.conf

36 lines
861 B
Nginx Configuration File
Raw Normal View History

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml;
# Angular SPA routing
location / {
try_files $uri $uri/ /index.html;
}
# API proxy
location /graphql {
proxy_pass http://student-api:5000;
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;
}
location /health {
proxy_pass http://student-api:5000;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}