Docker: nextcloud:fpm Request Entity Too Large

Created on 10 Jun 2017  路  10Comments  路  Source: nextcloud/docker

I am running a docker-compose setup using nextcloud:fpm, nginx, nginx-proxy and docker-letsencrypt-nginx-proxy-companion (based on the example in .example, but without a non-sqlite db, redis or collabora). This works for the most part, however I cannot upload files larger than 2MB. According to #32 docker-letsencrypt-nginx-proxy-companion can cause this, but adding a client_max_body_size setting to the default or VIRTUAL_HOST-specific vhost.d files has no effect.

Could this be caused by the fast_cgi in the fpm module? I tried adding fastcgi_param PHP_VALUE "upload_max_filesize = 4000M \n post_max_size=4000M"; to the server config but this doesn't appear to have any effect either.

enhancement

Most helpful comment

You don't have to edit the default.conf. Just add another file with any name containing just the line @pr4xx posted.

uploadsize.conf:

client_max_body_size 10G;

I usally do this by mounting the extra file in docker-compose:

docker-compose.yml:

version: '3'

volumes:
  conf.d:
  vhost.d:
  html:
  certs:


services:
  proxy:
    image: jwilder/nginx-proxy:alpine
    ports:
      - 80:80
      - 443:443
    volumes:
      - conf.d:/etc/nginx/conf.d
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./uploadsize.conf:/etc/nginx/conf.d/uploadsize.conf:ro
    networks:
      - proxy-tier
    restart: always
    labels:
      - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - certs:/etc/nginx/certs:rw
      - conf.d:/etc/nginx/conf.d:ro
      - html:/usr/share/nginx/html:rw
      - vhost.d:/etc/nginx/vhost.d
    restart: always

networks:
  proxy-tier:

All 10 comments

Seems like your proxy setting was fine, but the error is in the image: #97

Using docker-compose there should be some way to overwrite the conf files but trying nearly everything I am still unable to make it work. Does anyone have a hint?

Seems like the error is coming from the nginx proxy.

Please try to add

client_max_body_size 10G;

to the end of _proxy/vhost.d/default_

Restart the proxy and try to upload a > 2MB file.

I have the same issue. It works if I add the client_max_body_size 1G; to proxy/vhost.d/default. But this file is eresased/templated if I restart the letsencrypt-companion container. Don't know where I can put some extra config for it nginx or letsencrypt container.

Hmm, this is strange.
I have updated everything, restarted all instances and even rebooted.
My entry is still there.

did you restart your letsencrypt-companion container?

Restarting it in my case always overwritte the default file

 % sudo cat default    
## Start of configuration add by letsencrypt contain
location /.well-known/acme-challenge/ {
    allow all;
    root /usr/share/nginx/html;
    try_files $uri =404;
    break;
}
client_max_body_size 1G;
## End of configuration add by letsencrypt container


 % sudo docker restart letsencrypt-companion
letsencrypt-companion



 % sudo cat default 
## Start of configuration add by letsencrypt container
location /.well-known/acme-challenge/ {
    allow all;
    root /usr/share/nginx/html;
    try_files $uri =404;
    break;
}
## End of configuration add by letsencrypt container

I had the same issue and resolved it via creating a my.conf in proxy/conf.d with the following content:
client_max_body_size 10G;

Thx @pr4xx that's almost what I did after reading the nginx docker documentation :)

@l00ptr You have to add the line from @bang-uin after the last comment about letsenscrypt otherwise it will be overwritten.

## Start of configuration add by letsencrypt contain
location /.well-known/acme-challenge/ {
    allow all;
    root /usr/share/nginx/html;
    try_files $uri =404;
    break;
}
## End of configuration add by letsencrypt container

client_max_body_size 10G;

You don't have to edit the default.conf. Just add another file with any name containing just the line @pr4xx posted.

uploadsize.conf:

client_max_body_size 10G;

I usally do this by mounting the extra file in docker-compose:

docker-compose.yml:

version: '3'

volumes:
  conf.d:
  vhost.d:
  html:
  certs:


services:
  proxy:
    image: jwilder/nginx-proxy:alpine
    ports:
      - 80:80
      - 443:443
    volumes:
      - conf.d:/etc/nginx/conf.d
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./uploadsize.conf:/etc/nginx/conf.d/uploadsize.conf:ro
    networks:
      - proxy-tier
    restart: always
    labels:
      - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - certs:/etc/nginx/certs:rw
      - conf.d:/etc/nginx/conf.d:ro
      - html:/usr/share/nginx/html:rw
      - vhost.d:/etc/nginx/vhost.d
    restart: always

networks:
  proxy-tier:
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gjedeer picture gjedeer  路  3Comments

ghost picture ghost  路  3Comments

all-the-good-ones-are-gone picture all-the-good-ones-are-gone  路  3Comments

waldner picture waldner  路  3Comments

tanja84dk picture tanja84dk  路  3Comments