nextcloud 設置文件最大上傳限制


nextcloud 設置文件最大上傳限制

官方文檔| Uploading big files > 512MB — Nextcloud 14 Administration Manual 14 documentation

nginx

從nginx 1.7.11開始,fastcgi_request_buffering提供了一個新的配置選項。在 nginx 配置中將此選項設置為可能有助於在上傳過程中出現超時。此外,如果您系統的tmp分區上的磁盤空間不足,它會有所幫助。fastcgi_request_buffering off;

注意

確保它指向一個分區,該分區具有足夠的空間來容納您的上載文件大小,並且與 或 位於同一分區上(見下文)。為獲得最佳性能,請將這些硬盤放在專用於交換和臨時存儲的單獨硬盤上。client_body_temp_path``upload_tmp_dir``tempdirectory

如果您的站點位於 nginx 前端后面(例如負載均衡器):

默認情況下,由於前端和在前端上,下載將被限制為 1GB。proxy_buffering``proxy_max_temp_file_size

配置 PHP

如果您不想使用Nextcloud或文件,則可以改用PHP。如果您輸入了任何與上傳大小相關的行,請確保注釋掉任何行。.htaccess``.user.ini``.htaccess

如果您在 32 位系統上運行 Nextcloud,則需要注釋掉文件中的任何指令。open_basedir``php.ini

在 中設置以下兩個參數,使用您自己的所需文件大小值:php.ini

upload_max_filesize = 16G
post_max_size = 16G

告訴 PHP 您希望它使用哪個臨時目錄:

upload_tmp_dir = /var/big_temp_file/

必須在 或 中關閉輸出緩沖,否則 PHP 將返回與內存相關的錯誤:.htaccess``.user.ini``php.ini

  • output_buffering = 0

配置下一個雲

作為PHP的替代方案(例如,如果您無權訪問您的),您還可以使用您的設置為上傳的文件配置臨時位置(請參閱配置參數)。upload_tmp_dir``php.ini``tempdirectory``config.php

如果已在(請參閱配置參數)文件中配置了該設置,請確保它不會太低。此設置需要至少配置為最長上載所需的時間(以秒為單位)。如果不確定,請從配置中完全刪除此設置,以將其重置為 中顯示的默認值。session_lifetime``config.php``config.sample.php

在 GUI 中配置上載限制

如果本文檔中描述的所有先決條件都已准備就緒,則管理員可以使用 Nextcloud 管理后端中的輸入框按需更改上傳限制。File handling

..admin_filehandling-1/_images.png

根據您的環境,您可能會收到為此輸入框顯示的權限不足消息。

../_images/admin_filehandling-2.png

為了能夠使用此輸入框,您需要確保:

  • 您的Web服務器能夠使用Nextcloud提供的文件(僅限Apache).htaccess
  • 您的 Web 服務器正在運行的用戶對文件具有寫入權限,並且.htaccess``.user.ini

nginx

Since nginx 1.7.11 a new config option fastcgi_request_buffering is availabe. Setting this option to in your nginx config might help with timeouts during the upload. Furthermore it helps if you’re running out of disc space on the tmp partition of your system.fastcgi_request_buffering off;

Note

Make sure that points to a partition with adequate space for your upload file size, and on the same partition as the or (see below). For optimal performance, place these on a separate hard drive that is dedicated to swap and temp storage.client_body_temp_path``upload_tmp_dir``tempdirectory

If your site is behind a nginx frontend (for example a loadbalancer):

By default, downloads will be limited to 1GB due to and on the frontend.proxy_buffering``proxy_max_temp_file_size

Configuring PHP

If you don’t want to use the Nextcloud or file, you may configure PHP instead. Make sure to comment out any lines pertaining to upload size, if you entered any..htaccess``.user.ini``.htaccess

If you are running Nextcloud on a 32-bit system, any directive in your file needs to be commented out.open_basedir``php.ini

Set the following two parameters inside , using your own desired file size values:php.ini

upload_max_filesize = 16G
post_max_size = 16G

Tell PHP which temp directory you want it to use:

upload_tmp_dir = /var/big_temp_file/

Output Buffering must be turned off in or or , or PHP will return memory-related errors:.htaccess``.user.ini``php.ini

  • output_buffering = 0

Configuring Nextcloud

As an alternative to the of PHP (e.g. if you don’t have access to your ) you can also configure a temporary location for uploaded files by using the setting in your (See Configuration Parameters).upload_tmp_dir``php.ini``tempdirectory``config.php

If you have configured the setting in your (See Configuration Parameters) file then make sure it is not too low. This setting needs to be configured to at least the time (in seconds) that the longest upload will take. If unsure remove this completely from your configuration to reset it to the default shown in the .session_lifetime``config.php``config.sample.php

Configuring upload limits within the GUI

If all prerequisites described in this documentation are in place an admin can change the upload limits on demand by using the input box within the administrative backend of Nextcloud.File handling

../_images/admin_filehandling-1.png

Depending on your environment you might get an insufficient permissions message shown for this input box.

../_images/admin_filehandling-2.png

To be able to use this input box you need to make sure that:

  • your Web server is able to use the file shipped by Nextcloud (Apache only).htaccess
  • the user your Web server is running as has write permissions to the files and .htaccess``.user.ini


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM