Files
coze-studio/nginx-gateway/conf.d/20-coze.conf
T
zgene 87d6dcc293 refactor: extract nginx to standalone nginx-gateway deployment
- Remove coze-web service from docker-compose.yml
- Replace nginx second stage in frontend/Dockerfile with alpine dist-only stage
- Add nginx-gateway/ with standalone nginx container deployment
  - docker-compose.yml joining both coze-network and kong-net
  - Split nginx configs into 6 per-domain files:
    - 00-upstreams.conf (shared upstreams)
    - 10-default-server.conf (catch-all 444)
    - 20-coze.conf (coze studio)
    - 30-kong-api.conf (kong ai gateway)
    - 40-admin-portal.conf (admin portal)
    - 50-grafana.conf (grafana dashboard)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 15:06:15 +08:00

77 lines
2.6 KiB
Plaintext

# ============================================================
# Coze Studio
# 域名: testcoze.kejiankejian.com / coze-testcoze.kejiankejian.com
# ============================================================
# HTTP -> HTTPS
server {
listen 80;
listen [::]:80;
server_name testcoze.kejiankejian.com coze-testcoze.kejiankejian.com;
return 301 https://$host$request_uri;
}
# HTTPS
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name testcoze.kejiankejian.com coze-testcoze.kejiankejian.com;
client_max_body_size 100M;
ssl_certificate /etc/nginx/ssl/_.kejiankejian.com_chain.pem;
ssl_certificate_key /etc/nginx/ssl/_.kejiankejian.com_key.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256;
access_log /dev/stdout;
error_log /dev/stderr;
# 前端静态资源
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
add_header Cache-Control "public, max-age=3600" always;
}
# 后端 API
location ~ ^/(api|v[1-3]|admin)(/|$) {
proxy_pass http://coze_backend;
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;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 600s;
sub_filter ':8889' ':8888/local_storage';
sub_filter 'minio:9000' '$http_host/local_storage';
sub_filter_once off;
sub_filter_types 'application/json' 'text/event-stream';
}
# MinIO 文件代理
location /local_storage/ {
rewrite ^/local_storage/(.*)$ /$1 break;
proxy_pass http://coze_minio;
proxy_set_header Host coze-minio:9000;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 600s;
add_header Access-Control-Allow-Origin "*" always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Access-Control-Allow-Methods "*" always;
add_header Access-Control-Allow-Headers "*" always;
if ($request_method = 'OPTIONS') {
return 204;
}
}
}