未找到NGINX代理\u密码

未找到NGINX代理\u密码,nginx,Nginx,我尝试了以下答案,但没有成功,还有一些其他答案。我也看过文档,但是我不知道我做错了什么。当我点击/,我会看到nginx主页(很好)。当我尝试点击/alpha时,我得到了404。卷曲到127.0.0.1:5001可以让我从主持人那里得到我所期望的。谁能告诉我错过了什么 配置: http { server { listen 80; location /prealpha/ {

我尝试了以下答案,但没有成功,还有一些其他答案。我也看过文档,但是我不知道我做错了什么。当我点击/,我会看到nginx主页(很好)。当我尝试点击
/alpha
时,我得到了404。卷曲到
127.0.0.1:5001
可以让我从主持人那里得到我所期望的。谁能告诉我错过了什么

配置:

  http {
         server {
                listen 80;

                location /prealpha/ {
                        proxy_pass http://127.0.0.1:5000/;
                }
                location /alpha/ {
                        proxy_pass http://127.0.0.1:5001/;
                }
                location /beta/ {
                        proxy_pass http://127.0.0.1:5002/;
                }
                location /gamma/ {
                        proxy_pass http://127.0.0.1:5003/;
                }
        }
更新 nginx调试输出中的以下日志似乎表明keepalive无法正常工作,然后连接被关闭。我是否需要使用上游或其他方式使连接保持打开状态

2019/09/18 12:11:03 [debug] 8688#8688: *2 http upstream request: "/alpha/?"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http upstream process header
2019/09/18 12:11:03 [debug] 8688#8688: *2 malloc: 000055B88E563AE0:4096
2019/09/18 12:11:03 [debug] 8688#8688: *2 recv: eof:0, avail:1
2019/09/18 12:11:03 [debug] 8688#8688: *2 recv: fd:9 484 of 4096
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy status 404 "404 NOT FOUND"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header: "Server: gunicorn/19.7.1"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header: "Date: Wed, 18 Sep 2019 12:11:03 GMT"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header: "Connection: close"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header: "Content-Type: text/html"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header: "Content-Length: 232"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header: "Set-Cookie: oidc_id_token=; Expires=Thu, 01-Jan-1970 00:00:00 GMT; HttpOnly; Path=/"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header: "Vary: Cookie"
2019/09/18 12:11:03 [debug] 8688#8688: *2 http proxy header done
2019/09/18 12:11:03 [debug] 8688#8688: *2 xslt filter header
2019/09/18 12:11:03 [debug] 8688#8688: *2 posix_memalign: 000055B88E538C60:4096 @16
2019/09/18 12:11:03 [debug] 8688#8688: *2 HTTP/1.1 404 NOT FOUND
Server: nginx/1.14.0 (Ubuntu)
Date: Wed, 18 Sep 2019 12:11:03 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: oidc_id_token=; Expires=Thu, 01-Jan-1970 00:00:00 GMT; HttpOnly; Path=/
Vary: Cookie
Content-Encoding: gzip
主要更新

结果表明,nginx正在将位置选择器(不确定实际调用了什么htis,但在顶部的配置中,它是表示“/prealpha/”的位)传递到代理传递URL。我需要它不要那样做。它只需将该点之后的所有内容传递给代理。我怎样才能让它做到这一点呢?

最终,我修复了它


因此,简而言之,没有错误日志,请求被清晰地传递(一旦我在nginx中启用了调试日志记录),然后在我在gunicorn中启用调试日志记录之后,就表明传递了错误的url。

您正在命中没有斜杠的位置,但是您的
位置
将只在斜杠后面工作。当你点击
/alpha/
(希望后面的斜杠)时,结果是什么?我刚刚得到一个404.Access日志,显示它是404,但没有错误日志。