admin 发表于 2024-9-6 13:59:57

New-API 部署到 Compose 失败了?

服务已启动但无法访问,防火墙已放开。日志显示OpenAI token encoder请求超时,导致服务无法正常运行。
相关配置:之前使用 Docker 部署没有问题,现在使用 Compose 部署遇到了问题。Nginx配置如下:
```
server {
    listen 443 ssl;
    server_name api.xxx.com www.api.xxx.com;
    ssl_certificate /root/.acme.sh/xxx.com_ecc/fullchain.cer;
    ssl_certificate_key /root/.acme.sh/xxx.com_ecc/xxx.com.key;
    location / {
      proxy_pass http://127.0.0.1:3300;
      proxy_set_header Host $host;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
```
本地连接测试成功:
```
# telnet 127.0.0.1 3300
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
```
Compose配置如下:
```
services:
new-api:
    image: calciumion/new-api:v0.2.8.0
    container_name: new-api
    restart: always
    ports:
      - "3300:3300"
    environment:
      - SQL_DSN=adc:Abc163#@tcp(mysql:3306)/oneapi
      - TZ=Asia/Shanghai
    volumes:
      - /home/ubuntu/data/new-api:/data
    networks:
      - mysql_network
      
networks:
mysql_network:
    external: true
```
页: [1]
查看完整版本: New-API 部署到 Compose 失败了?