36 lines
899 B
Nginx Configuration File
36 lines
899 B
Nginx Configuration File
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name _;
|
||
|
|
charset utf-8;
|
||
|
|
|
||
|
|
root /usr/share/nginx/html;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
# Frontend - Vue history mode
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
expires 1h;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Backend API proxy
|
||
|
|
location /prod-api/ {
|
||
|
|
proxy_pass http://backend:8080/;
|
||
|
|
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_connect_timeout 30s;
|
||
|
|
proxy_read_timeout 120s;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Static assets caching
|
||
|
|
location ~* \.(js|css|png|jpg|gif|ico|woff|woff2|ttf|svg)$ {
|
||
|
|
expires 30d;
|
||
|
|
add_header Cache-Control "public, immutable";
|
||
|
|
}
|
||
|
|
|
||
|
|
# Gzip
|
||
|
|
gzip on;
|
||
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
||
|
|
gzip_min_length 1000;
|
||
|
|
}
|