Files
algorithm/api-gateway/ai-services.conf

61 lines
1.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# /etc/nginx/conf.d/ai-services.conf
server {
listen 80;
server_name localhost;
# 服务1文本分类网关路径/ai/text-classify
location /ai/text-classify/ {
proxy_pass http://text-classification:8000/;
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_connect_timeout 30s;
proxy_read_timeout 30s;
}
# 服务2图像识别网关路径/ai/image-recog
location /ai/image-recog/ {
proxy_pass http://image-recognition:8000/;
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_connect_timeout 30s;
proxy_read_timeout 30s;
}
# 服务3语音转文字网关路径/ai/speech-to-text
location /ai/speech-to-text/ {
proxy_pass http://speech-to-text:8000/;
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_connect_timeout 30s;
proxy_read_timeout 30s;
}
# OpenAI代理服务网关路径/ai/openai
location /ai/openai/ {
proxy_pass http://openai-proxy:8000/;
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_connect_timeout 30s;
proxy_read_timeout 30s;
}
# 后端服务(网关路径/api
location /api/ {
proxy_pass http://backend:8000/;
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_connect_timeout 30s;
proxy_read_timeout 30s;
}
# 健康检查
location /health {
return 200 'OK';
}
}