server { listen 80; server_name official.inkreach.cc; client_max_body_size 10m; # ACME challenge for cert renewals location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 301 https://$host$request_uri; } } server { listen 443 ssl; http2 on; server_name official.inkreach.cc; ssl_certificate /etc/nginx/certs/official.inkreach.cc_ecc/fullchain.cer; ssl_certificate_key /etc/nginx/certs/official.inkreach.cc_ecc/official.inkreach.cc.key; ssl_protocols TLSv1.2 TLSv1.3; client_max_body_size 10m; root /usr/share/nginx/html; location /.well-known/acme-challenge/ { root /var/www/certbot; } # Admin SPA location /admin/ { try_files $uri $uri/ /admin/index.html; } location = /admin { return 301 /admin/; } # v2(refactor/v2 分支)路径分流:SPA 原样透传给 v2 admin 容器,/v2-api 去掉前缀转发到 v2 api location /v2/admin/ { proxy_pass http://v2-admin:80; proxy_http_version 1.1; 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; } # v2 版 H5:透传给 v2 admin 容器(文件在 v2 镜像内,路径 /v2/h5/) location /v2/h5/ { proxy_pass http://v2-admin:80; proxy_http_version 1.1; 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; } location /v2-api/ { proxy_pass http://v2-api:3001/; proxy_http_version 1.1; 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; } # H5 历史构建的 API 基址是同源相对路径 /public/*(BASE_URL="/"),直通 v2 api(路径原样透传) location /public/ { proxy_pass http://v2-api:3001; proxy_http_version 1.1; 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; } location = /h5 { return 301 /h5/; } location /h5/{ try_files $uri $uri/ /h5/index.html; } # Uploaded files served by the API location /uploads/ { proxy_pass http://api:3001/uploads/; proxy_set_header Host $host; } # Static product assets served by the API location /assets/ { proxy_pass http://api:3001/assets/; proxy_set_header Host $host; } # Website placeholder until the public site is deployed location / { return 302 /admin/; } }