# 上传对象到私有S3不起作用

**URL:** https://meta.discourse.org/t/upload-objects-to-private-s3-is-not-working/181574
**Category:** Support
**Tags:** s3
**Created:** [2021年三月2日 08:57 UTC](https://meta.discourse.org/t/upload-objects-to-private-s3-is-not-working/181574 "2021-03-02T08:57:43Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![seong](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/seong/32/259022_2.png) [@seong](https://meta.discourse.org/u/seong)
#### Post date: [2022年六月11日 11:22 UTC](https://meta.discourse.org/t/upload-objects-to-private-s3-is-not-working/181574/5 "2022-06-11T11:22:52Z")

</div>

我遇到了同样的问题：备份可以正常工作，但上传失败。

本指南已过时：

> [@Set up file and image uploads to S3](https://meta.discourse.org/t/setting-up-file-and-image-uploads-to-s3/7229):
>
> So, you want to use S3 to handle image uploads? Here’s the definitive guide, but also see [Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/configure-an-s3-compatible-object-storage-provider-for-uploads/148916) to see how to configure your app.yml. S3 registration Head over to [https://aws.amazon.com/free/](https://aws.amazon.com/free/) and click on [Create a Free Account] During the create account process, make sure you provide payment information, otherwise you won’t be able to use S3. There’s no registration fee, you will only be charged for [what you use](https://aws.amazon.com/s3/pricing/), if you exceed the [AWS F…](https://aws.amazon.com/free/)

本指南似乎对 CDN 部分很有价值，但不是完整的解决方案：

> [@scottfsmith](#):
>
> 供参考，这是我所做的：
> 
> 1. 转到 AWS 控制台，在网络和内容分发下选择 Cloudfront
> 2. 单击“创建分发”按钮
> 3. 填写了显而易见的表单，您真正需要做的就是在其中从下拉菜单中选择您的 AWS S3 存储桶（图片来源）。
> 4. 等待 Cloudfront 配置完成……
> 5. 在 Cloudfront 分发列表的“域名”列中出现了一个 `\u003cgibberish\u003e.cloudfront.net` 域。
> 6. 我将该域复制并粘贴到我的站点管理员文件设置的 `s3 cdn url` 字段中。
> 7. 我做了一些测试：  
> a. 我发布了一个带有图片上传的新帖子，它确实是在 cloudfront 上。  
> b. 我点击了对一些随机现有图片帖子的“重建 HTML”，发现它们也使用 `cloudfront.net` 图片进行了重建。
> 8. 既然一切看起来都不错，我就去运行了一个重新烘焙，这花了几个小时，因为我现在有大约五十万个帖子：
> 
> ```plaintext
> ./launcher enter app
> # rake posts:rebake
> 
> ```
> 
> 1. 一切似乎都运行正常。它在 sidekiq 队列中放入了大量作业，看起来每个帖子一个，这需要几天时间才能清除，但它正在逐步处理它们。

---

_[View the full topic](https://meta.discourse.org/t/upload-objects-to-private-s3-is-not-working/181574)._
