Big File Upload Configuration (> 512MB)

Introduction

The default maximum file size for uploads, in ownCloud, is 512MB. You can increase this limit up to the maximum file size which your filesystem, operating system, or other software allows, for example:

  • < 2GB on a 32Bit OS-architecture

  • < 2GB with IE6 - IE8

  • < 4GB with IE9 - IE11

64-bit filesystems have much higher limits. Please consult the documentation for your filesystem.

The ownCloud sync client itself however is able to upload files of any size, as it uploads files by transmitting them in small chunks. But, it can never exceed the maximum file size limits of the remote host.

System Configuration

  • Make sure that the latest version of PHP (at least 5.6) is installed

  • Disable user quotas, which makes them unlimited

  • Your temp file or partition has to be big enough to hold multiple parallel uploads from multiple users; e.g. if the max upload size is 10GB and the average number of users uploading at the same time is 100: temp space has to hold at least 10x100 GB

Configuring Your Web server

ownCloud comes with its own owncloud/.htaccess file. Because php-fpm can’t read PHP settings in .htaccess these settings must be set in the owncloud/.user.ini file.

Set the following two parameters inside the corresponding php.ini file (see the Loaded Configuration File section of PHP Version and Information to find your relevant php.ini files) :

php_value upload_max_filesize = 16G
php_value post_max_size = 16G

Adjust these values for your needs. If you see PHP timeouts in your logfiles, increase the timeout values, which are in seconds:

php_value max_input_time 3600
php_value max_execution_time 3600

mod_reqtimeout

The mod_reqtimeout Apache module could also stop large uploads from completing. If you’re using this module and getting failed uploads of large files, either disable it in your Apache config or raise the configured RequestReadTimeout timeouts.

Disable mod_reqtimeout On Ubuntu

On Ubuntu, you can disable the module by running the following command:

a2dismod reqtimeout

Disable mod_reqtimeout On CentOS

On CentOS, you have to edit /etc/httpd/conf/httpd.conf, and comment out the following line:

LoadModule reqtimeout_module modules/mod_reqtimeout.so

When you have done run asdismod or updated /etc/httpd/conf/httpd.conf, restart Apache.

There are also several other configuration options in your web server config which could prevent the upload of larger files. Please see your web server’s manual, for how to configure those values correctly:

Apache with mod_fcgid

If you are using Apache/2.4 with mod_fcgid, as of February/March 2016, FcgidMaxRequestInMem still needs to be significantly increased from its default value to avoid the occurence of segmentation faults when uploading big files. This is not a regular setting but serves as a workaround for Apache with mod_fcgid bug #51747.

Setting FcgidMaxRequestInMem significantly higher than normal may no longer be necessary, once bug #51747 is fixed.

NGINX

Since NGINX 1.7.11 a new config option fastcgi_request_buffering is availabe. Setting this option to fastcgi_request_buffering off; 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.

For more info how to configure NGINX to raise the upload limits see also this wiki entry.

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

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

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

Configuring PHP

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

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

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

upload_max_filesize = 16G
post_max_size = 16G

Tell PHP which temp file you want it to use:

upload_tmp_dir = /var/big_temp_file/

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

  • output_buffering = 0

Configuring ownCloud

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

If you have configured the session_lifetime setting in your config.php (See Sample Config PHP 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 config.sample.php.

General upload issues

Various environmental factors could cause a restriction of the upload size. Examples are:

  • The LVE Manager of CloudLinux which sets a I/O limit

  • Some services like Cloudflare are also known to cause uploading issues

  • Upload limits enforced by proxies used by your clients

  • Other webserver modules like described in General Troubleshooting