Files
2026-07-24 14:04:21 +08:00

39 lines
1.1 KiB
Nginx Configuration File
Raw Permalink 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.
# 完整主配置:覆盖 nginx:alpine 默认 /etc/nginx/nginx.conf
# 新版 nginx 在受限容器内写 /run/nginx.pid 会报 Operation not permitted 并致命退出,
# 这里把 pid 显式改到可写的 /tmpmain 上下文唯一一处),避免前端容器反复重启。
pid /dev/null;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# SPA 兜底hash 路由下深链接也可正常加载)
location / {
try_files $uri $uri/ /index.html;
}
# 后端 API保留 /api 前缀转发到 avatar-backend:8000
location /api/ {
proxy_pass http://avatar-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;
}
}
}