Nginx – Nextcloud: Bad Request (expected filesize XXX got 8192)

fastcginextcloudnginxphp-fpm

I am transitioning from ownCloud to Nextcloud. Everything seems to work, only the upload doesn't work, yet. Everytime I upload via the Web Interface, I get the "Bad Request" message. Via the Desktop client, I also get "Bad Request" with some additional information.

server replied: Bad Request (expected filesize 86622 got 8192)

I get this for every file I upload, except that of course the first filesize is different, the "got" part is always 8192. This appears to be as if there was some kind of limit to 8192 bytes somewhere, but I can not find it.

I was originally running ownCloud in a Docker container with Apache, served by NGinx via proxy_pass. Now I installed php5-fpm and set it up to run under my user account (so that Nextcloud will create the files with the correct ownership).

/home/niklas/
  nextcloud/
    data/           (Nextcloud data directory)
    nextcloud/      (Nextcloud source code)
    php-fpm/        (php5-fpm configuration and runtime files)
      conf
      www.conf
      pid
      sock

I've copied the php5-fpm configuration from /etc/php5/fpm/php-fpm.conf and pool.d/www.conf respectively and updated them. You can find the configurations below. The NGinx configuration is also mostly copied from here.

Where could this error come from?


Unfortunately I can not paste the configuration here as it is too long for the Question's body.


Apparently this has to do with my way of running php5-fpm. When I use the system configured php5-fpm daemon, it works. I can not understand why that is, though.

Best Answer

I ran into the same error. I fixed it by removing the enviroment variables related to tmp. Maybe someone will find a better solution, but this made it work again for me.

Just comment them in and it should work again.

   ;env[TMP] = /home/niklas/nextcloud/tmp
   ;env[TMPDIR] = /home/niklas/nextcloud/tmp
   ;env[TEMP] = /home/niklas/nextcloud/tmp