繁体   English   中英

Nginx 位置重定向

[英]Nginx Location Redirect

如果你愿意, 伙计们,帮我解决这个问题

跟到底哪个参数w=和h=做代理传给他,只有URL关联两个参数w=和h=。 我试图这样做,但它不起作用

> $1 = for the file name which is Ar.BB_1585493889.png
> $2 = for width(w=) 
> $3 = for height (h=)


location ~* ^/storage/app/profiles/(.*)?w\=(.*)\&h\=(.*) {
proxy_pass http:/123.com:8888/unsafe/$2x$3/smart/https://123.com/storage/app/profiles/$1;
}

非常感谢您的帮助。

与我的同事合作,他解决了其中的难题,我发现了代理传递的解决方案,这完全是关于通过代理将拇指图像重定向到 Nginx,因此移动团队不必更改任何 URL。

        location ~* ^/storage/app/profiles/(.*) {
#error_page   400 401 402 403 404 405 500 501 502 503 504  @error_page;
                set $image $1;
                if ($is_args = "?") {
                        rewrite ^.*$ "/unsafe/${arg_w}x${arg_h}/smart/https://123.com/storage/app/profiles/$image?" break;
                        proxy_pass http://127.0.0.1:8888;

                }
        }

如果 Thumbor 服务器不工作,您仍然可以使用 error_page 将人们重定向到真正的 url。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM