openai聊天功能求救

v
https://www.workerman.net/plugin/157

接口流式响应,本地可以,服务器上不行,接口没错误信息和日志
扩展包安装了,也重启了
宝塔nginx+php8.1默认配置

截图
截图

300 1 0
1个回答

walkor 打赏

可能是nginx配置问题,直接访问8787端口不经过nginx试下。
宝塔和服务器安全组记得开8787端口

  • v 2024-09-27

    cursor好强啊,可以了

    server
    {
        listen 80;
        server_name test.top;
        index index.html index.htm default.htm default.html;
        root /www/wwwroot/webman/start.php;
    
        # ... 其他配置保持不变 ...
        #REWRITE-START 伪静态相关配置
        include /www/server/panel/vhost/rewrite/other_webman.conf;
        #REWRITE-END
    
        #禁止访问的文件或目录
        location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|package.json|package-lock.json|\.env) {
            return 404;
        }
    
        #一键申请SSL证书验证目录相关设置
        location /.well-known/ {
            root /www/wwwroot/java_node_ssl;
        }
    
        #禁止在证书验证目录放入敏感文件
        if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
            return 403;
        }
    
          # HTTP反向代理相关配置开始 >>>
        location ~ /purge(/.*) {
            proxy_cache_purge cache_one 127.0.0.1$request_uri$is_args$args;
        }
    
        location / {
            proxy_pass http://127.0.0.1:9501;
            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_set_header REMOTE-HOST $remote_addr;
            add_header X-Cache $upstream_cache_status;
            proxy_set_header X-Host $host:$server_port;
            proxy_set_header X-Scheme $scheme;
    
            # 修改以下配置以支持流式响应
            proxy_buffering off;
            proxy_cache off;
            proxy_http_version 1.1;
            chunked_transfer_encoding on;
    
            proxy_read_timeout 300s;
            proxy_connect_timeout 300s;
    
            # 保持长连接
            proxy_set_header Connection "keep-alive";
    
            # 添加调试头
            add_header X-Debug-Message "Proxied through Nginx" always;
        }
    
        # 修改错误日志路径
        error_log /www/wwwlogs/webman_error.log debug;
        access_log /www/wwwlogs/webman_access.log;
    }
  • v 2024-09-27

    谢谢,是nginx的问题

×
🔝