# 使用BackBlaze+Cloudflare搭建图床或文件下载站

**BackBlaze收费情况：**

空间免费10G，超出后，超出部分每月每G 0.005美元；

流量每日免费1G，超出后，超出部分每G 0.01美元。

**设置方法：**

在BackBlaze创建仓库并上传图片或其他文件后，点击该文件，会弹出有关信息。

![文件信息](https://gitbookimgs.linh.eu.org/jzjs/jzjs-9-img/jzjs-9-1.png)

看到Friendly URL，记住前面的`f000.backblazeb2.com`。

将域名DNS切换到Cloudflare，添加解析记录，下面以`example.org`为例操作，请将此域名替换成您的域名。

添加记录，例如`img.example.org`，将`img`记录做CNAME到`f000.backblazeb2.com`，务必保持右侧的小黄云朵，不要切换！

进入SSL设置，将SSL设置为Full。

![SSL设置](https://gitbookimgs.linh.eu.org/jzjs/jzjs-9-img/jzjs-9-2.png)

此时，将Friendly URL中的`f000.backblazeb2.com`替换为`img.example.org`，链接其他地方不要修改，就可以了！注意：必须用https访问！

为了防止他人用您的域名访问其他仓库，在Cloudflare的Page rules中进行设置。如果他人试图用您的域名访问其他仓库，则会提示404。设置方法如下：

![Page rules设置](https://gitbookimgs.linh.eu.org/jzjs/jzjs-9-img/jzjs-9-3.png)

例如仓库名字叫blogpics，则您的链接为`https://img.exmaple.org/file/blogpics`，按图片中的方法设置即可，即：第一条规则设置`https://img.exmaple.org/file/blogpics/*`正常缓存，第二条规则`https://img.exmaple.org/file/*/*`设置跳转到404页面，具体设置方法见图片。Cloudflare免费用户每个域名可以设置3个Page rules。

参考文献：[BackBlaze官方文档](https://help.backblaze.com/hc/en-us/articles/217666928-Using-Backblaze-B2-with-the-Cloudflare-CDN)（英文）


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.linh.eu.org/jian-zhan-ji-shu/shi-yong-backblaze+cloudflare-da-jian-tu-chuang-huo-wen-jian-xia-zai-zhan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
