【问题标题】:Proxy external images with nginx使用 nginx 代理外部图像
【发布时间】:2013-02-10 05:52:02
【问题描述】:

有没有办法用 nginx 代理外部图像而无需在本地下载和存储它们? IE。像这样将图像的URI 传递给我的代理服务器:

`http://myproxydomain.com/http://example.com/image.jpg`

并在我网站上的图片的src 属性中包含此URI

【问题讨论】:

    标签: image proxy nginx


    【解决方案1】:

    是的——这是可能的:

        merge_slashes off;
    
        location ~ /(?<r>http://.*) {
            resolver 127.0.0.1;
            proxy_pass $r;
        }
    

    你是否应该这样做是另一回事。拥有merge_slashes off 可能不是一个好主意。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-15
      • 1970-01-01
      • 2013-11-24
      • 1970-01-01
      • 1970-01-01
      • 2010-11-07
      • 2023-01-16
      • 2010-09-18
      相关资源
      最近更新 更多