Files
CloudSearch/packages/frontend/nginx.conf

37 lines
896 B
Nginx Configuration File
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# 前端路由SPA
location / {
try_files $uri $uri/ /index.html;
}
# H5 手机版
location /h5 {
alias /usr/share/nginx/html/h5;
try_files $uri $uri/ /h5/index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# API 代理到后端
location /api/ {
proxy_pass http://backend:3000;
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;
proxy_buffering off;
proxy_read_timeout 120s;
}
# 静态资源缓存
location /assets {
expires 7d;
add_header Cache-Control "public, immutable";
}
}