geekai icon indicating copy to clipboard operation
geekai copied to clipboard

使用nginx反代之后,无法打开网站

Open nistudyc opened this issue 1 year ago • 7 comments

⚠️ 确认 issue 是否已存在 ⚠️

  • [X] 我已经搜索了现有的问题,没有找到跟我问题相关的问题。

GPT-3 or GPT-4

GPT-3.5

操作系统

Windows

Bug 描述 📝

我通过宝塔面板的nginx添加了配置文件实现域名访问后,对话功能就无法打开了,其他的功能都正常。想问下是否是配置出错?有其他的方法可以实现域名访问么?

重现步骤 🕹

5d065f21b84b1fd0d3e3987104e5f74 左侧是通过域名访问,右侧是通过ip+端口访问

你的应用配置信息

以下是我添加的配置 listen 80; # 这是默认的HTTP端口,你可能也希望80端口的流量能够重定向到443端口,增加安全性 server_name XXX.com; # 这里替换为你的域名

location / {
    proxy_pass http://localhost:8080; # 这个地址需要与Docker部署的地址一致
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
}

nistudyc avatar Jan 08 '24 08:01 nistudyc

要加上WS的

45571655 avatar Jan 08 '24 09:01 45571655

可否详细点说呢?具体是哪些服务?本人有点小白,谢谢!

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: 45571655 @.> 发送时间: 2024年1月8日 17:14 收件人: yangjian102621/chatgpt-plus @.> 抄送: Nick @.>, Author @.> 主题: Re: [yangjian102621/chatgpt-plus] 使用nginx反代之后,无法打开网站 (Issue #102)

要加上WS的

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

nistudyc avatar Jan 08 '24 09:01 nistudyc

map $http_upgrade $connection_upgrade { default upgrade; 'websocket' upgrade; } server {

location / {
    try_files $uri $uri/ /index.html;

    # 后端 API 的转发
    location /api/ {
            proxy_http_version 1.1;
            proxy_connect_timeout 300s;
            proxy_read_timeout 300s;
            proxy_send_timeout 12s;
            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 Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_pass http://chatgpt-plus-api:5678; 
    }

    # 静态资源转发
    location /static/ {
        proxy_pass http://chatgpt-plus-api:5678; 
    }
}

}

45571655 avatar Jan 08 '24 09:01 45571655

你好,我修改了proxy_pass这里为local,并且添加进去了nginx的配置文件,也重载过,但是依旧无法正常打开,是否是哪里我还需要进行修改的

nistudyc avatar Jan 08 '24 09:01 nistudyc

你好,我修改了proxy_pass这里为local,并且添加进去了nginx的配置文件,也重载过,但是依旧无法正常打开,是否是哪里我还需要进行修改的

解决了吗 同样问题

lmq352489099 avatar Apr 03 '24 09:04 lmq352489099

你要提供更详细的信息,比如,你通过什么方式部署的,一键部署脚本,还是一个一个容器单独跑的。你 config.toml 配置文档,你的 nginx 配置完整文档。还有无法访问是什么意思,打不开网站还是无法进行对话?

yangjian102621 avatar Apr 09 '24 01:04 yangjian102621

chatgpt-plus-web 里面有 nginx 的, 你要不域名指向 8080 , 要不域名指向 80 , 然后把 web 里面的 conf 复制出来 , 不建议这么搞 , 两层 nginx 没必要

gbkus123 avatar Apr 29 '24 05:04 gbkus123