mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-20 18:54:09 +00:00
docs
This commit is contained in:
@@ -4,9 +4,10 @@
|
|||||||
|
|
||||||
选择一个即可。
|
选择一个即可。
|
||||||
|
|
||||||
1. [clash 方案](./proxy/clash.md) - 仅需一台服务器(需要有 clash)
|
1. [sealos nginx 方案](./proxy/sealos.md) - 推荐。约等于不用钱,不需要额外准备任何东西。
|
||||||
2. [nginx 方案](./proxy/nginx.md) - 需要一台国外服务器
|
2. [clash 方案](./proxy/clash.md) - 仅需一台服务器(需要有 clash)
|
||||||
3. [cloudflare 方案](./proxy/cloudflare.md) - 需要有域名(每日免费 10w 次代理请求)
|
3. [nginx 方案](./proxy/nginx.md) - 需要一台国外服务器
|
||||||
|
4. [cloudflare 方案](./proxy/cloudflare.md) - 需要有域名(每日免费 10w 次代理请求)
|
||||||
|
|
||||||
### 1. 准备一些内容
|
### 1. 准备一些内容
|
||||||
|
|
||||||
@@ -179,7 +180,7 @@ services:
|
|||||||
- /root/fastgpt/nginx/ssl/docgpt.key:/ssl/docgpt.key
|
- /root/fastgpt/nginx/ssl/docgpt.key:/ssl/docgpt.key
|
||||||
- /root/fastgpt/nginx/ssl/docgpt.pem:/ssl/docgpt.pem
|
- /root/fastgpt/nginx/ssl/docgpt.pem:/ssl/docgpt.pem
|
||||||
pg:
|
pg:
|
||||||
image: ankane/pgvector
|
image: ankane/pgvector:v0.4.1
|
||||||
container_name: pg
|
container_name: pg
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
@@ -49,7 +49,7 @@ services:
|
|||||||
- /root/fastgpt/nginx/ssl/docgpt.key:/ssl/docgpt.key
|
- /root/fastgpt/nginx/ssl/docgpt.key:/ssl/docgpt.key
|
||||||
- /root/fastgpt/nginx/ssl/docgpt.pem:/ssl/docgpt.pem
|
- /root/fastgpt/nginx/ssl/docgpt.pem:/ssl/docgpt.pem
|
||||||
pg:
|
pg:
|
||||||
image: ankane/pgvector
|
image: ankane/pgvector:v0.4.1
|
||||||
container_name: pg
|
container_name: pg
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
BIN
docs/deploy/proxy/imgs/sealos1.png
Normal file
BIN
docs/deploy/proxy/imgs/sealos1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 MiB |
BIN
docs/deploy/proxy/imgs/sealos2.png
Normal file
BIN
docs/deploy/proxy/imgs/sealos2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 205 KiB |
BIN
docs/deploy/proxy/imgs/sealos3.png
Normal file
BIN
docs/deploy/proxy/imgs/sealos3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 152 KiB |
BIN
docs/deploy/proxy/imgs/sealos4.png
Normal file
BIN
docs/deploy/proxy/imgs/sealos4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
BIN
docs/deploy/proxy/imgs/sealos5.png
Normal file
BIN
docs/deploy/proxy/imgs/sealos5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 224 KiB |
@@ -1,4 +1,5 @@
|
|||||||
# nginx 反向代理 openai 接口
|
# nginx 反向代理 openai 接口
|
||||||
|
|
||||||
如果你有国外的服务器,可以通过配置 nginx 反向代理,转发 openai 相关的请求,从而让国内的服务器可以通过访问该 nginx 去访问 openai 接口。
|
如果你有国外的服务器,可以通过配置 nginx 反向代理,转发 openai 相关的请求,从而让国内的服务器可以通过访问该 nginx 去访问 openai 接口。
|
||||||
|
|
||||||
```conf
|
```conf
|
||||||
@@ -43,7 +44,7 @@ http {
|
|||||||
|
|
||||||
location ~ /openai/(.*) {
|
location ~ /openai/(.*) {
|
||||||
# auth check
|
# auth check
|
||||||
if ($http_authkey != "xxxxxx") {
|
if ($auth != "xxxxxx") {
|
||||||
return 403;
|
return 403;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
100
docs/deploy/proxy/sealos.md
Normal file
100
docs/deploy/proxy/sealos.md
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
# sealos 部署 openai 中转
|
||||||
|
|
||||||
|
## 登录 sealos cloud
|
||||||
|
|
||||||
|
[sealos cloud](https://cloud.sealos.io/)
|
||||||
|
|
||||||
|
## 创建应用
|
||||||
|
|
||||||
|
打开 App Launchpad -> 新建应用
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
### 开启外网访问
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 添加 configmap 文件
|
||||||
|
|
||||||
|
1. 复制下面这段代码,注意 `server_name` 后面的内容替换成上图的地址。
|
||||||
|
|
||||||
|
```
|
||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
worker_rlimit_nofile 51200;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
resolver 8.8.8.8;
|
||||||
|
proxy_ssl_server_name on;
|
||||||
|
|
||||||
|
access_log off;
|
||||||
|
server_names_hash_bucket_size 512;
|
||||||
|
client_header_buffer_size 64k;
|
||||||
|
large_client_header_buffers 4 64k;
|
||||||
|
client_max_body_size 50M;
|
||||||
|
|
||||||
|
proxy_connect_timeout 240s;
|
||||||
|
proxy_read_timeout 240s;
|
||||||
|
proxy_buffer_size 128k;
|
||||||
|
proxy_buffers 4 256k;
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name tgohwtdlrmer.cloud.sealos.io; # 这个地方替换成 sealos 提供的内容
|
||||||
|
|
||||||
|
location ~ /openai/(.*) {
|
||||||
|
# auth check
|
||||||
|
if ($http_auth != "auth") { # 安全凭证
|
||||||
|
return 403;
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy_pass https://api.openai.com/$1$is_args$args;
|
||||||
|
proxy_set_header Host api.openai.com;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
# 如果响应是流式的
|
||||||
|
proxy_set_header Connection '';
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
chunked_transfer_encoding off;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_cache off;
|
||||||
|
# 如果响应是一般的
|
||||||
|
proxy_buffer_size 128k;
|
||||||
|
proxy_buffers 4 256k;
|
||||||
|
proxy_busy_buffers_size 256k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 点开高级配置
|
||||||
|
3. 点击新增 configmap
|
||||||
|
4. 文件名写: `/etc/nginx/nginx.conf`
|
||||||
|
5. 文件值为刚刚复制的那段代码
|
||||||
|
6. 点击确认
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 部署应用
|
||||||
|
|
||||||
|
填写完毕后,点击右上角的 `部署应用`,即可完成。
|
||||||
|
|
||||||
|
## 修改 FastGpt 环境变量
|
||||||
|
|
||||||
|
1. 进入刚刚部署应用的详情,复制外网地址
|
||||||
|

|
||||||
|
|
||||||
|
2. 修改环境变量:
|
||||||
|
|
||||||
|
```
|
||||||
|
OPENAI_BASE_URL=https://tgohwtdlrmer.cloud.sealos.io/openai/v1
|
||||||
|
OPENAI_BASE_URL_AUTH=auth
|
||||||
|
```
|
||||||
|
|
||||||
|
**Done!**
|
Reference in New Issue
Block a user