Nginx 配置 proxy_pass http://127.0.0.1:7681 后,结果是 404,无法跳转到 ttyd 服务,即使 proxy_pass http://127.0.0.1:7681 后面不加斜杠 /,也仍然报 404 错误。

请尝试以下几个步骤:

  1. 确认 ttyd 服务是否已经启动,并且监听的端口号是否为 7681。

  2. 确认 Nginx 的配置文件中是否正确配置了 proxy_pass 指令,例如:

    location /ttyd {
        proxy_pass http://127.0.0.1:7681;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_read_timeout 86400;
    }
    
  3. 确认 Nginx 是否已经重新加载了配置文件,可以使用以下命令:

    nginx -t # 检查配置文件是否正确
    nginx -s reload # 重新加载配置文件
    
  4. 如果以上步骤都没有解决问题,可以尝试在 ttyd 服务的配置文件中增加以下指令:

    'disableLeaveAlert': true
    

    然后重新启动 ttyd 服务并尝试访问。

Nginx 配置 proxy_pass 无法访问 ttyd 服务:404 错误解决方案

原文地址: https://www.cveoy.top/t/topic/fVd7 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录