nginx:配置内网转发阿里云oss

配置如下

  location ^~ /oss/ {
   
    if ( $request_uri ~* \.(png|jpg|jpeg) ){
   
       set $args "x-oss-process=style/watermark";
    }

    proxy_pass http://<bucket>.oss-cn-beijing-internal.aliyuncs.com/;
    proxy_set_header Host <bucket>.oss-cn-beijing-internal.aliyuncs.com;
    proxy_hide_header Content-Disposition;
}

如果匹配不到,请检查:

  • 文件是否存在
  • 阿里云oss是否配置外网访问
  • 注意nginx优先级

通过ECS中Nginx反向代理到阿里云OSS内网,浏览器直接显示图片和文本
nginx路由location匹配规则及其优先级

相关推荐

  1. nginx配置转发阿里oss

    2024-02-04 15:32:02       51 阅读
  2. oss阿里oss服务器模拟

    2024-02-04 15:32:02       40 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-04 15:32:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-04 15:32:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-02-04 15:32:02       82 阅读
  4. Python语言-面向对象

    2024-02-04 15:32:02       91 阅读

热门阅读

  1. js的深拷贝与浅拷贝

    2024-02-04 15:32:02       48 阅读
  2. python实现的LDA算法

    2024-02-04 15:32:02       47 阅读
  3. 【力扣刷题练习】876. 链表的中间结点

    2024-02-04 15:32:02       43 阅读
  4. leetcode-2的幂

    2024-02-04 15:32:02       52 阅读
  5. 滴滴面经相关知识整理(基于newbing)

    2024-02-04 15:32:02       61 阅读
  6. 开源软件的发展

    2024-02-04 15:32:02       52 阅读
  7. Kubernetes - DAEMONSET 与 DEPLOYMENT 区别

    2024-02-04 15:32:02       46 阅读
  8. threejs之常用贴图

    2024-02-04 15:32:02       50 阅读
  9. Docker 第九章 : Docker 容器的互联(linking)

    2024-02-04 15:32:02       43 阅读