server { server_name "ai.moicen.com"; listen 443 ssl; client_max_body_size 10M; ssl_certificate /etc/letsencrypt/live/moicen.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/moicen.com/privkey.pem; location / { try_files $uri $uri/ /index.html; proxy_set_header Host "ai.moicen.com"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $remote_addr; } location /api/v1/index { return 200 "Ai api index"; } add_header Access-Control-Allow-Origin $http_origin always; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always; add_header Access-Control-Allow-Headers 'Authorization,unionid,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always; add_header Access-Control-Allow-Credentials true always; add_header Access-Control-Max-Age 86400 always; if ($request_method = 'OPTIONS') { return 200; } location /api/v1/ai/ { proxy_set_header Host $host; add_header Access-Control-Allow-Origin $http_origin always; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always; add_header Access-Control-Allow-Headers 'Authorization,HtyAdminToken,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always; add_header Access-Control-Allow-Credentials true always; add_header Access-Control-Max-Age 86400 always; if ($request_method = 'OPTIONS') { return 200; } proxy_pass http://127.0.0.1:5000/; } location /api/v1/coze/ { proxy_set_header Host $host; add_header Access-Control-Allow-Origin $http_origin always; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always; add_header Access-Control-Allow-Headers 'Authorization,HtyAdminToken,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always; add_header Access-Control-Allow-Credentials true always; add_header Access-Control-Max-Age 86400 always; if ($request_method = 'OPTIONS') { return 200; } proxy_pass http://127.0.0.1:6000/; } }