网络技术 阿里云项目部署

【转】阿里云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刷新。

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

  1. I’ve been browsing online greater than three hours lately, but I never discovered any
    fascinating article like yours. It is beautiful price sufficient for me.
    In my opinion, if all web owners and bloggers made
    just right content as you probably did, the internet
    will probably be a lot more useful than ever
    before.

  2. Do you mind if I quote a few of your articles as long as I
    provide credit and sources back to your webpage?
    My blog site is in the very same niche as yours and my
    users would really benefit from some of the information you present here.
    Please let me know if this okay with you.
    Appreciate it!

  3. Great goods from you, man. I have understand your stuff previous to and you’re just too wonderful.
    I actually like what you have acquired here, really like
    what you are saying and the way in which you say it. You make it enjoyable and you still
    care for to keep it wise. I can’t wait to read far more from you.
    This is actually a great website.

发表评论

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

答案 : *
28 − 14 =


返回顶部