小编Ste*_*nsz的帖子

502 Bad Gateway - NGINX 没有定义解析器来解析

我为多个 URL 创建了一个代理通行证。

    listen 80;
    listen [::]:80;

    server_name ~^(.*)redzilla\.11\.75\.65\.21\.xip\.io$;

            location / {
                    set $instname $1;
                    proxy_pass http://${instname}redzilla.localhost:3000;
            }
Run Code Online (Sandbox Code Playgroud)

当我使用 chrome 调用此服务时,触发了 502 错误。

http://test.redzilla.11.75.65.21.xip.io/

我通过硬编码 URL 将位置标记放在下面。

            location /redzilla {
                    proxy_pass http://test.redzilla.localhost:3000;
            }
Run Code Online (Sandbox Code Playgroud)

然后它仅适用于上述 URL。我想知道如何在单个位置标签中为多个 URL 创建代理传递。(请注意:URL 模式为 *.redzilla.localhost:3000 ,*(星号)代表任何单词)

reverse-proxy localhost nginx nginx-reverse-proxy

10
推荐指数
1
解决办法
6822
查看次数