【转】阿里云oss错误:Forbidden access to the original image

好长时间没看网站了,今天突然发现了一个问题就是所有的图片都看不到了。如图:

遇到这种问题的时候,不要慌,因为oss涉及了多层通讯,需要先排查问题。我先看了一下http状态码。我用的是chrome浏览器,按Ctrl+Shift+i调出控制台,点击network,展示如下图,可以看到图片文件是403,也就是说这个文件还在,地址也正确,但是访问这个地址请求不到这个资源,那就是被禁止了。这样一来,原因就能通过一个状态码来分析出来,排查的范围就大大缩小了。

首先,php.ini、nginx.conf包括mysql那边我都没改过。这个问题出现的也是非常突然。那么我觉得问题就在阿里云oss的配置上,oss的配置有站内和站外,站内就是WordPress的插件,站外就是阿里云oss的控制台。我先打开了WordPress的插件,验证了AccessKey信息正确,域名正确,路径正确,ssl正确,oss也没用cdn。网站上是从没改过的,这就可以排除oss插件配置是正常的。

 

我在新窗口中打开了状态码为的403图片

在message中看到了一句[Forbidden access to the original image],不用一个词一个词的解释了,这句话意思是禁止访问原始图像。原始图像(original image),我记得oss控制台里面有这个选项近似的意思,果然找到了。正确的步骤如下

  1. 登陆阿里云oss控制台https://oss.console.aliyun.com
  2. 选择bucket
  3. 图片处理
  4. 访问设置
  5. 关闭原图保护
  6. 回到站内Ctrl+F5刷新,或Ctrl+Shift+i打开Network勾选Disable Cache刷新。

【转】阿里云oss错误:Forbidden access to the original image》有5个想法

  1. Hi there I am so delighted I found your web site, I really
    found you by accident, while I was searching on Aol for something else, Anyhow I am here now and would just like
    to say thank you for a fantastic post and a all round entertaining blog (I also love the theme/design),
    I don’t have time to go through it all at the moment but I have bookmarked it and also added
    your RSS feeds, so when I have time I will be back to read
    much more, Please do keep up the excellent job.

  2. 总感觉有些功能不知道是不成熟还是什么原因,用了就会有各种问题。CDN中也有些功能用了就会出问题。阿里云这个OSS的原图保护应该还是比较给力的,就是不知道为什么会有问题

  3. Hi I am so excited I found your weblog, I really found you by mistake, while I was
    searching on Google for something else, Anyways I am here now and
    would just like to say thank you for a remarkable
    post and a all round exciting blog (I also love the theme/design), I don’t have time to read through it all at the moment
    but I have saved it and also included your RSS
    feeds, so when I have time I will be back to read much
    more, Please do keep up the excellent jo.

  4. We are a bunch of volunteers and starting a new scheme in our
    community. Your web site offered us with valuable information to work
    on. You have done a formidable process and our entire community will
    probably be thankful to you.

发表评论

电子邮件地址不会被公开。 必填项已用*标注

答案 : *
12 + 9 =