更改最大附件/上传大小

:bookmark: 本指南说明了如何为自托管的 Discourse 实例更改最大附件上传大小。

:person_raising_hand: 所需用户级别:系统管理员

默认的附件上传大小限制为 10MB

如果您自托管 Discourse 并且需要允许上传大于 10MB 的文件,请按照以下步骤操作。

更改上传大小

  1. 连接到您的服务器:
  • 使用 SSH 访问您服务器的命令行界面。
  1. 编辑配置文件:
  • 导航到配置目录并编辑 app.yml 文件:
cd /var/discourse/
nano containers/app.yml
  1. 修改上传参数:
  • 查找标记为 params 的部分。在该部分下方,仔细注意格式要求,添加您期望的上传大小:
params:
  ## 此容器应使用哪个 Git 版本? (默认值: latest)
  version: latest
  ## 最大上传大小 (默认值: 10m)
  upload_size: 20m
  1. 保存更改:
  • Ctrl+X 退出,然后按 Y 确认,再按 Enter 保存更改。
  1. 重建 Discourse 实例:
  • /var/discourse 目录运行以下命令:
./launcher rebuild app
  1. 更新站点设置:
  • 在您的 Discourse 控制面板中前往 /admin/site_settings/category/files
  • max attachment size kb(最大附件大小 KB)和 max image size kb(最大图片大小 KB)调整为您首选的大小(例如 20 MB)。设置界面允许您输入值并从下拉列表中选择一个单位(KB、MB 或 GB)。

:exclamation: 这两个设置都受到 nginx 的 client_max_body_size 值的限制,该值由第 3 步中设置的 upload_size 参数控制。站点设置不能超过此限制。

62 个赞
Can't Increase the Max File Size
What is the max image upload size limit by file type
Struggling to find correct instructions to increase file upload limit
Image upload size/resize question
Upload Large Video
Can't Increase the Max File Size
What is the maximum file size we can upload on discourse?
Rebuild of Discourse fails due to spaces in YAML file
With Uploads -- That page doesn’t exist or is private
Image upload error when using resizer
:cn: Change the max size of uploads/attachments | Discourse 修改上传附件的大小
Category image upload stops at 0%
Attachments max size limit in self and business hosting difference
Do I need to install NGINX and PHP to optimize my Discourse forum?
Remove Dropbox Onebox For Audio Links
Issue with maximum upload file size
Uploads involving client-side JS preprocessing fail in Chrome based browsers
“Image larger than 4mb” error when posting a gif
Inquiry About Discourse’s Support for Amazon S3 Storage
Maxmum upload size
Meta Data From Image Upload
Set file size upload to 17 megs, unable to upload 12.2 meg file
NGinx.conf File location
Multipart upload
Can Discourse accept attachments when using emails to create new category topics?
What is the maximum file size we can upload on discourse?
Problem about attachment file size
Max upload size error
Why is my upload limit 100mb?It's set to 500mb
Issue with maximum upload file size
Increasing max file size
How to change upload limit by command line
Attachments: Oops! That page doesn’t exist or is private
Increase the file size of attachment
Sorry, that file is too big V2
Raising max file upload limit in configs
Allow log file for topic and restricted to admin