2026-07-03 16:01:08 +08:00
|
|
|
# =============================================
|
|
|
|
|
# 文件管理系统 - 生产环境 Nginx 配置
|
|
|
|
|
# =============================================
|
|
|
|
|
|
|
|
|
|
worker_processes auto;
|
2026-07-18 10:52:32 +08:00
|
|
|
worker_rlimit_nofile 65535;
|
2026-07-03 16:01:08 +08:00
|
|
|
|
|
|
|
|
events {
|
2026-07-18 10:52:32 +08:00
|
|
|
worker_connections 10240;
|
|
|
|
|
multi_accept on;
|
2026-07-03 16:01:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
http {
|
|
|
|
|
include mime.types;
|
|
|
|
|
default_type application/octet-stream;
|
2026-07-18 10:52:32 +08:00
|
|
|
server_tokens off;
|
|
|
|
|
sendfile on;
|
|
|
|
|
tcp_nopush on;
|
|
|
|
|
tcp_nodelay on;
|
|
|
|
|
keepalive_timeout 65;
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
# 全局上传限制
|
|
|
|
|
client_max_body_size 2g;
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
|
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
|
|
|
'"$http_user_agent" "$http_x_forwarded_for" '
|
|
|
|
|
'$request_time $upstream_response_time';
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
# Gzip
|
|
|
|
|
gzip on;
|
|
|
|
|
gzip_vary on;
|
|
|
|
|
gzip_proxied any;
|
|
|
|
|
gzip_comp_level 6;
|
|
|
|
|
gzip_buffers 16 8k;
|
|
|
|
|
gzip_http_version 1.1;
|
|
|
|
|
gzip_min_length 1024;
|
|
|
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
|
|
|
|
|
|
|
|
|
|
# 代理通用头部
|
|
|
|
|
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 on;
|
|
|
|
|
proxy_connect_timeout 60s;
|
|
|
|
|
proxy_read_timeout 300s;
|
|
|
|
|
proxy_send_timeout 300s;
|
2026-07-03 16:01:08 +08:00
|
|
|
|
|
|
|
|
# =============================================
|
2026-07-18 10:52:32 +08:00
|
|
|
# Server 1: 前端 + API (主入口)
|
2026-07-03 16:01:08 +08:00
|
|
|
# =============================================
|
|
|
|
|
server {
|
2026-07-18 10:52:32 +08:00
|
|
|
listen 5173;
|
|
|
|
|
server_name 36.133.248.69;
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
|
|
|
add_header X-Content-Type-Options "nosniff";
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
# API 反向代理
|
|
|
|
|
location /api/ {
|
|
|
|
|
proxy_pass http://36.133.248.69:8075;
|
|
|
|
|
client_max_body_size 2g;
|
|
|
|
|
}
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
# 文件 CDN / 本地存储
|
|
|
|
|
location /public/ {
|
|
|
|
|
alias D:/fileSys/localStorage/;
|
|
|
|
|
expires 7d;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
add_header Access-Control-Allow-Origin "https://36.133.248.69";
|
|
|
|
|
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
|
|
|
|
}
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
# 前端 SPA
|
|
|
|
|
location / {
|
|
|
|
|
root D:/fileSys/dist;
|
|
|
|
|
index index.html;
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
|
|
|
|
|
expires 30d;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
}
|
|
|
|
|
location = /index.html {
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
|
|
|
}
|
2026-07-03 16:01:08 +08:00
|
|
|
}
|
2026-07-18 10:52:32 +08:00
|
|
|
}
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
# =============================================
|
|
|
|
|
# Server 2: MinIO API 代理
|
|
|
|
|
# =============================================
|
|
|
|
|
server {
|
|
|
|
|
listen 9033;
|
|
|
|
|
server_name 36.133.248.69;
|
|
|
|
|
client_max_body_size 2g;
|
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
proxy_pass http://127.0.0.1:9000;
|
|
|
|
|
proxy_set_header Host $http_host;
|
2026-07-03 16:01:08 +08:00
|
|
|
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_read_timeout 300s;
|
|
|
|
|
proxy_send_timeout 300s;
|
|
|
|
|
}
|
2026-07-18 10:52:32 +08:00
|
|
|
}
|
2026-07-03 16:01:08 +08:00
|
|
|
|
2026-07-18 10:52:32 +08:00
|
|
|
# =============================================
|
|
|
|
|
# Server 3: MinIO 控制台
|
|
|
|
|
# =============================================
|
|
|
|
|
server {
|
|
|
|
|
listen 9034;
|
|
|
|
|
server_name 36.133.248.69;
|
|
|
|
|
client_max_body_size 50m;
|
2026-07-03 16:01:08 +08:00
|
|
|
|
|
|
|
|
location / {
|
2026-07-18 10:52:32 +08:00
|
|
|
proxy_pass http://127.0.0.1:9001;
|
|
|
|
|
proxy_set_header Host $http_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_http_version 1.1;
|
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection "upgrade";
|
2026-07-03 16:01:08 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|