2 Go limit on download -- NextCloud 18.0.6


We are using NextCloud since a while and all is good with it. We are using NextCloud 18.0.6 on Ubunto 16.04 LTS and Php 7.3.

But we are facing a problem, Nextcloud stop download if files bigger than 2 Go. We can upload big files like 7 Go but if we try to download these big files either in our network or in home/domestic network it stop downloading at 2 Go exactly all times.

It seems that it is not a parameter that i can configure in the GUI and i don’t see any limit in nginx.conf. Maybe the limit is coming from PHP but i can’t find where.

Is there a way to configure no limit for downloading files ?


Is your system 32 bit? That is known to have problems with files larger than 2 GiB, however it would be strange that the upload works…
Check your logfiles as well, if your webserver <-> php <-> database communication does not run into timeouts at some point.

Perhaps this configuration in Apache2.


Can you post your modified configurations in apache2 or nginx to find the problem?

I think with Nextcloud 20 you must change to Ubuntu 18.04 LTS or better 20.04 LTS because of your old php-version if you do not want to install from third-parties.

It is a x64 16.04 LTS Ubuntu.

I take a look in logfiles.


Thanks for the answers,

In the /var/log/nginx/error.log i got this log :

2020/06/22 13:06:31 [error] 8452#8452: *389 readv() failed (104: Connection reset by peer) while reading upstream, client:, server: cloud.lyc-renaudeau-49.ac-nantes.fr, request: “GET /index.php/apps/files/ajax/download.php?dir=%2FLogiciels%2FSolidworks%2FSOLIDWORKS%202019%20SP02&files=swwi&downloadStartSecret=ol072k5aho HTTP/2.0”, upstream: “fastcgi://unix:/var/run/nextcloud.sock:”, host: “cloud.lyc-renaudeau-49.ac-nantes.fr

And on the same download attempt i got this in /var/log/php7.3-fpm.log :

[22-Jun-2020 13:06:31] WARNING: [pool nextcloud] child 8657, script ‘/var/www/nextcloud/index.php’ (request: “GET /index.php?dir=%2FLogiciels%2FSolidworks%2FSOLIDWORKS%202019%20SP02&files=swwi&downloadStartSecret=ol072k5aho”) execution timed out (349.785708 sec), terminating
[22-Jun-2020 13:06:31] WARNING: [pool nextcloud] child 8657 exited on signal 15 (SIGTERM) after 7187.268456 seconds from start
[22-Jun-2020 13:06:31] NOTICE: [pool nextcloud] child 10528 started

I don’t understand what is wrong but maybe can help you understand.


Here my /etc/nginx/nginx.conf file :

user www-data;
worker_processes 1;
pid /run/nginx.pid;

events {
worker_connections 768;
# multi_accept on;

http {

# Basic Settings

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# SSL Settings

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

# Logging Settings

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

# Gzip Settings

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

# Virtual Host Configs

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;


#mail {

# See sample authentication script at:

# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript

# auth_http localhost/auth.php;

# pop3_capabilities “TOP” “USER”;

# imap_capabilities “IMAP4rev1” “UIDPLUS”;

server {

listen localhost:110;

protocol pop3;

proxy on;


server {

listen localhost:143;

protocol imap;

proxy on;



Here my /etc/php/7.3/fpm/pool.d/nextcloud.conf file:

listen = /var/run/nextcloud.sock

listen.owner = nextcloud
listen.group = www-data

user = nextcloud
group = www-data

pm = ondemand
pm.max_children = 54
pm.process_idle_timeout = 60s
pm.max_requests = 500

env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

request_terminate_timeout = 300

And finally mi /etc/nginx/sites-available/nextcloud file:

upstream php-handler {
server unix:/var/run/nextcloud.sock;

server {
listen 80;
listen [::]:80;
server_name cloud.lyc-renaudeau-49.ac-nantes.fr;
return 301 https://$server_name$request_uri;


server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name cloud.lyc-renaudeau-49.ac-nantes.fr;

# Path to the root of your installation
root                          /var/www/nextcloud/;

ssl                           on;
ssl_certificate               /etc/letsencrypt/live/cloud.lyc-renaudeau-49.ac-nantes.fr/fullchain.pem;
ssl_certificate_key           /etc/letsencrypt/live/cloud.lyc-renaudeau-49.ac-nantes.fr/privkey.pem;
ssl_trusted_certificate       /etc/letsencrypt/live/cloud.lyc-renaudeau-49.ac-nantes.fr/chain.pem;
ssl_dhparam                   /etc/ssl/certs/dhparam.pem;

ssl_session_cache             shared:SSL:1m;
ssl_session_timeout           1440m;
ssl_buffer_size               8k;
ssl_protocols                 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers     on;
ssl_stapling                  on;
ssl_stapling_verify           on;

# Add headers to serve security related headers
add_header                    X-Content-Type-Options nosniff;
add_header                    X-XSS-Protection "1; mode=block";
add_header                    X-Robots-Tag none;
add_header                    X-Download-Options noopen;
add_header                    X-Permitted-Cross-Domain-Policies none;
add_header                    Strict-Transport-Security 'max-age=31536000; includeSubDomains;';
add_header			  Referrer-Policy no-referrer;	

location = /robots.txt {
    allow                     all;
    log_not_found             off;
    access_log                off;

location = /.well-known/carddav {
  return                      301 $scheme://$host/remote.php/dav;

location = /.well-known/caldav {
  return                      301 $scheme://$host/remote.php/dav;

# set max upload size
client_max_body_size          512M;
fastcgi_buffers               64 4K;

# Enable gzip but do not remove ETag headers
gzip                          on;
gzip_vary                     on;
gzip_comp_level               4;
gzip_min_length               256;
gzip_proxied                  expired no-cache no-store private no_last_modified no_etag auth;
gzip_types                    application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

location / {
    rewrite                   ^ /index.php$uri;

location ~ ^/.well-known/acme-challenge/* {
    allow                     all;

location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
    deny                      all;

location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
    deny                      all;

location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+).php(?:$|/) {
    fastcgi_split_path_info   ^(.+.php)(/.*)$;
    include                   fastcgi_params;
    fastcgi_param             SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param             PATH_INFO $fastcgi_path_info;
    fastcgi_param             HTTPS on;
    fastcgi_param             modHeadersAvailable true;
    fastcgi_param             front_controller_active true;
    fastcgi_pass              php-handler;
    fastcgi_intercept_errors  on;
    fastcgi_request_buffering off;
    fastcgi_read_timeout      300;

location ~ ^/(?:updater|ocs-provider)(?:$|/) {
    try_files                 $uri/ =404;
    index                     index.php;

# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~* .(?:css|js|woff|svg|gif)$ {
    try_files                 $uri /index.php$uri$is_args$args;
    add_header                Cache-Control "public, max-age=15778463";
    add_header                X-Content-Type-Options nosniff;
    add_header                X-XSS-Protection "1; mode=block";
    add_header                X-Robots-Tag none;
    add_header                X-Download-Options noopen;
    add_header                X-Permitted-Cross-Domain-Policies none;
    # Optional: Don't log access to assets
    access_log                off;

location ~* .(?:png|html|ttf|ico|jpg|jpeg)$ {
    try_files                 $uri /index.php$uri$is_args$args;
    # Optional: Don't log access to other assets
    access_log                off;