1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| user root; worker_processes 1;
events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream;
sendfile on; keepalive_timeout 65;
client_max_body_size 500M; # HTTP server block, redirect to HTTPS 此部分内容可以由证书网站生成 server { listen 80; server_name sxqxyyl.cn www.sxqxyyl.cn;
# Redirect HTTP to HTTPS return 301 https://$host$request_uri; }
# HTTPS server block server { listen 443 ssl; server_name sxqxyyl.cn www.sxqxyyl.cn;
# SSL certificate and key # SSL 相关内容可以由证书网站生成
location / { root /root/frontend/dist; index index.html index.htm; # 确保这是您的网站根目录 try_files $uri $uri/ /index.html; }
# 前端访问路径配置为 /api location /api/ { rewrite ^/api/(.*)$ /$1 break; # 确保路径被重写为后端应用需要的格式 proxy_pass http://127.0.0.1:8888/; # 将请求转发到后端服务 proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
location /minio/ { proxy_pass http://127.0.0.1:9000/; # MinIO 运行在 HTTP 9000 端口 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
# Error pages for 500, 502, 503, 504 error_page 500 502 503 504 /50x.html; location = /50x.html { root /root/frontend/dist; } } }
|