1 Star 0 Fork 0

dongda/aidea-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
nginx.conf 2.89 KB
一键复制 编辑 原始数据 按行查看 历史
server {
listen 80;
# 这里配置服务器的域名
#server_name api.aidea.com;
gzip on;
gzip_static on;
gzip_vary on;
gzip_types text/plain application/x-javascript text/css application/xml text/xml application/javascript;
# 这里配置 SSL 证书路径
#ssl_certificate /etc/nginx/certs.d/api.aidea.com.pem;
#ssl_certificate_key /etc/nginx/certs.d/api.aidea.com.key;
# 将用户端的真实 IP 传递给后端服务
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;
# 支持跨域(Web 端专用)
add_header Access-Control-Allow-Origin * always;
add_header Access-Control-Allow-Methods GET,OPTIONS,POST,PUT,DELETE always;
add_header Access-Control-Allow-Headers x-platform-version always;
add_header Access-Control-Allow-Headers x-client-version always;
add_header Access-Control-Allow-Headers x-platform always;
add_header Access-Control-Allow-Headers x-language always;
add_header Access-Control-Allow-Headers authorization always;
add_header Access-Control-Allow-Headers content-type always;
add_header Access-Control-Allow-Headers openai-organization always;
# 默认禁止直接访问 API 根地址
location / {
rewrite ^/(.*) http://127.0.0.1 redirect;
}
# 如果你在同一台服务器上部署了 AIdea 前端项目,这里指定前端项目的路径
# 注意不要忘记注释掉上面的默认禁止直接访问 API 根地址的配置
# location / {
# root /data/app;
# index index.html;
# try_files $uri $uri/ =404;
# }
# OpenAI Chat Stream 协议支持(服务端推送)
location /v1/chat/completions {
proxy_pass http://ai_api_backend;
proxy_set_header Upgrade $http_upgrade;
proxy_http_version 1.1;
proxy_set_header Connection 'upgrade';
chunked_transfer_encoding off;
proxy_cache off;
proxy_buffering off;
proxy_read_timeout 300s;
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;
}
# 公开 API v1
location /v1/ {
proxy_pass http://ai_api_backend;
}
# 公开 API v2
location /v2/ {
proxy_pass http://ai_api_backend;
}
# 公开 API
location /public/ {
proxy_pass http://ai_api_backend;
}
# Universal Link
location /.well-known/apple-app-site-association {
proxy_pass http://ai_api_backend;
}
}
upstream ai_api_backend {
# 后端服务地址
server 192.168.0.109:8080;
keepalive 32;
}
# 所有 HTTP 请求重定向到 HTTPS
#server {
# listen 80;
# # 这里配置服务器的域名
# server_name api.aidea.com;
#
# rewrite ^(.*) https://api.aidea.com$1 permanent;
#}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/dongda6/aidea-server.git
[email protected]:dongda6/aidea-server.git
dongda6
aidea-server
aidea-server
develop

搜索帮助