2025-12-26 21:02:15 +08:00
|
|
|
events {
|
|
|
|
|
worker_connections 1024;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
http {
|
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
|
default_type application/octet-stream;
|
2026-02-27 10:26:41 +08:00
|
|
|
client_max_body_size 10G; # 允许的最大文件大小为 10GB
|
2025-12-31 10:04:50 +08:00
|
|
|
|
2025-12-26 21:02:15 +08:00
|
|
|
server {
|
2025-12-31 09:32:01 +08:00
|
|
|
listen 3001;
|
2025-12-26 21:02:15 +08:00
|
|
|
server_name localhost;
|
2026-02-27 10:26:41 +08:00
|
|
|
|
|
|
|
|
# ============================================
|
|
|
|
|
# 用户认证相关接口 (/user-api/*)
|
|
|
|
|
# ============================================
|
2025-12-30 11:19:28 +08:00
|
|
|
location /user-api/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
2025-12-30 14:19:22 +08:00
|
|
|
proxy_set_header Authorization $http_authorization;
|
2025-12-31 10:13:48 +08:00
|
|
|
proxy_pass http://localhost:33333/user/;
|
2025-12-30 11:19:28 +08:00
|
|
|
}
|
2026-02-27 10:26:41 +08:00
|
|
|
|
|
|
|
|
# ============================================
|
|
|
|
|
# 文件服务接口 (/file/*)
|
|
|
|
|
# ============================================
|
2025-12-30 11:19:28 +08:00
|
|
|
location /file/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
2025-12-30 14:19:22 +08:00
|
|
|
proxy_set_header Authorization $http_authorization;
|
2025-12-31 10:00:06 +08:00
|
|
|
proxy_pass http://localhost:33333/file/;
|
2026-02-27 10:26:41 +08:00
|
|
|
}
|
2026-02-27 11:04:39 +08:00
|
|
|
# ============================================
|
|
|
|
|
# 文件服务接口 (/file/*)
|
|
|
|
|
# ============================================
|
|
|
|
|
location /api/file/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
|
proxy_set_header Authorization $http_authorization;
|
|
|
|
|
proxy_pass http://localhost:33333/file/;
|
|
|
|
|
}
|
2026-02-27 10:26:41 +08:00
|
|
|
|
|
|
|
|
# ============================================
|
|
|
|
|
# Story 相关接口 (/api/story/*)
|
|
|
|
|
# ============================================
|
|
|
|
|
location /api/story/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
|
proxy_set_header Authorization $http_authorization;
|
|
|
|
|
proxy_pass http://localhost:33333/story/;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ============================================
|
|
|
|
|
# 用户服务接口 (/api/user/*)
|
|
|
|
|
# 包含: 用户资料、偏好设置、相册、集合等
|
|
|
|
|
# ============================================
|
|
|
|
|
location /api/user/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
|
proxy_set_header Authorization $http_authorization;
|
|
|
|
|
proxy_pass http://localhost:33333/user/;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ============================================
|
|
|
|
|
# API v1 版本接口 (/api/v1/*)
|
|
|
|
|
# 包含: 评论、点赞、同步、统计等
|
|
|
|
|
# ============================================
|
|
|
|
|
location /api/v1/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
|
proxy_set_header Authorization $http_authorization;
|
|
|
|
|
proxy_pass http://localhost:33333/user/api/v1/;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ============================================
|
|
|
|
|
# 地理信息接口 (/api/geographic/*)
|
|
|
|
|
# ============================================
|
|
|
|
|
location /api/geographic/ {
|
2025-12-30 11:19:28 +08:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
2025-12-30 14:19:22 +08:00
|
|
|
proxy_set_header Authorization $http_authorization;
|
2026-02-27 10:26:41 +08:00
|
|
|
proxy_pass http://localhost:33333/api/geographic/;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ============================================
|
|
|
|
|
# 通用 API 接口 (/api/*)
|
|
|
|
|
# 用于其他未明确配置的 API 路径
|
|
|
|
|
# ============================================
|
|
|
|
|
location /api/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
|
proxy_set_header Authorization $http_authorization;
|
|
|
|
|
proxy_pass http://localhost:33333/api/;
|
|
|
|
|
}
|
2025-12-26 21:02:15 +08:00
|
|
|
|
2026-02-27 10:26:41 +08:00
|
|
|
# ============================================
|
2026-02-12 16:55:05 +08:00
|
|
|
# MinIO 对象存储代理
|
|
|
|
|
# 需要在后端配置 minio.externalEndpoint 为 http://<domain>/minio
|
2026-02-27 10:26:41 +08:00
|
|
|
# ============================================
|
2026-02-12 16:55:05 +08:00
|
|
|
location /minio/ {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
|
proxy_pass http://localhost:9000/;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-27 10:26:41 +08:00
|
|
|
# ============================================
|
|
|
|
|
# 前端静态资源
|
|
|
|
|
# ============================================
|
2025-12-26 21:02:15 +08:00
|
|
|
location / {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html index.htm;
|
|
|
|
|
try_files $uri $uri/ /index.html; # 用于处理 SPA 路由
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
|
location = /50x.html {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|