Nextcloud is slowing my RPi down significantly and giving me Gateway Time-out 504 errors

I use a Rapberry Pi 3 and uploading files to NextCloud is giving me many Gateway 504 errors.

/var/log/nginx/domain.tld-error.log

2017/10/12 19:57:00 [error] 10373#0: *46404 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/avatar92.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 19:57:14 [error] 10371#0: *46412 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/avatar92_004.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 19:57:31 [error] 10371#0: *46440 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/avatar92_005.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 19:57:34 [error] 10371#0: *46441 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/avatar92_006.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:05:28 [error] 10374#0: *46674 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "MKCOL /nextcloud/remote.php/dav/files/videoseries_data HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:05:28 [error] 10374#0: *46671 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/white.html HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:05:28 [error] 10371#0: *46650 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/widget.ashx HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:05:29 [error] 10374#0: *46673 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/widget009.css HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:05:58 [error] 10374#0: *46670 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/widget009_002.css HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:06:28 [error] 10374#0: *46672 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/widget_002.ashx HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:06:29 [error] 10371#0: *46650 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/wpp.css HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:06:29 [error] 10374#0: *46671 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/Quinn-BBC-800x430.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:06:29 [error] 10374#0: *46673 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/Untitled.png HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:06:29 [error] 10374#0: *46674 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/widgets.js HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:12:01 [error] 10374#0: *46670 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/detector.js HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:12:01 [error] 10374#0: *46671 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/enhanced-22696-1407241409-12.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:12:01 [error] 10374#0: *46672 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/enhanced-buzz-wide-1574-1407240343-20.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:12:01 [error] 10371#0: *46650 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/enhanced-buzz-wide-6078-1407240045-15.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:12:01 [error] 10374#0: *46673 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/everyone-on-the-internet-wants-in-on-whatever-doo-2-29657-14.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:16:09 [error] 10374#0: *46901 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/some-guy-broke-up-with-his-cheating-girlfriend-th-2-5700-141.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:16:19 [error] 10374#0: *46898 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/this-dad-has-a-really-clever-way-of-making-the-be-2-15403-14.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:27:42 [error] 10371#0: *47112 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "MKCOL /nextcloud/remote.php/dav/files/J HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:30:45 [error] 10374#0: *47244 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/26291783.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:30:55 [error] 10373#0: *47209 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/29051323.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:36:51 [error] 10374#0: *47342 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/aa04cb60728c533c19e59ce5a33e3a89_normal.jpeg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:36:51 [error] 10374#0: *47340 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/be.gif HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:36:51 [error] 10372#0: *47309 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/befr.gif HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:37:01 [error] 10374#0: *47341 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/btn_donateCC_LG.gif HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:37:10 [error] 10373#0: *47316 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/cc HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:37:26 [error] 10374#0: *47322 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/ccc HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:42:29 [error] 10371#0: *47483 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/121213162257.foto.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:42:29 [error] 10371#0: *47481 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/130408192339.beachball.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:42:31 [error] 10371#0: *47482 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/130511140659.c-bard.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:42:31 [error] 10371#0: *47484 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/130913230228.bigstock-Tooth-Fairy-3835386-245x300.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:44:51 [error] 10371#0: *47484 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/pixel HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:44:52 [error] 10371#0: *47482 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/show_ads_impl.js HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:44:52 [error] 10371#0: *47481 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/toolbox.js HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:44:53 [error] 10373#0: *47439 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/twitterlogo2.gif HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:45:00 [error] 10371#0: *47480 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/user-default-small.gif HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:48:48 [error] 10373#0: *47687 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/131019210836.prego-martelo.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:48:48 [error] 10373#0: *47688 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/140315171612.poverty.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:48:48 [error] 10373#0: *47686 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/140623125449.220px-Eye-of-Horus-bw.svg.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 20:48:48 [error] 10373#0: *47653 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/140630133731.gekke.shrink.120x0.jpg HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 21:04:32 [error] 10373#0: *47962 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/user_offline.gif HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 21:04:33 [error] 10373#0: *47976 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/vbulletin_global.js HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 21:04:39 [error] 10373#0: *47975 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/vbulletin_important.css HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 21:09:53 [error] 10373#0: *47949 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files//utag_008.js HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 21:10:59 [error] 10373#0: *47977 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/pop'n'music/pop%20'n'%20music.doc HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 21:11:05 [error] 10373#0: *47975 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "PUT /nextcloud/remote.php/dav/files/individual%20concepts HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"
2017/10/12 21:11:05 [error] 10373#0: *47949 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.ip.v4.addr, server: domain.tld, request: "MKCOL /nextcloud/remote.php/dav/files/am HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-nextcloud.sock", host: "domain.tld"

Result of command I saw in another thread:

admin@YunoHost:~ $ sudo yunohost tools upgrade
Warning: You must provide a URL to upgrade your custom app cesium
Warning: unable to upgrade apps: [Errno 61] No app to upgrade
Traceback (most recent call last):
  File "/usr/bin/yunohost", line 219, in <module>
    timeout=opts.timeout,
  File "/usr/lib/python2.7/dist-packages/moulinette/__init__.py", line 136, in cli
    moulinette.run(args, output_as=output_as, password=password, timeout=timeout)
  File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/cli.py", line 390, in run
    ret = self.actionsmap.process(args, timeout=timeout)
  File "/usr/lib/python2.7/dist-packages/moulinette/actionsmap.py", line 495, in process
    return func(**arguments)
  File "/usr/lib/moulinette/yunohost/tools.py", line 514, in tools_upgrade
    logger.error(m18n.n('app_upgrade_failed'))
  File "/usr/lib/python2.7/dist-packages/moulinette/core.py", line 205, in n
    return self._namespaces[self._current_namespace].translate(key, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/moulinette/core.py", line 92, in translate
    return self._translations[self.locale][key].encode('utf-8').format(*args, **kwargs)
KeyError: 'app'

Good evening @folaht ,

I’m not a YunoHost’s dev but the result of the command

sudo yunohost tools upgrade

seems to indicate an upgrade’s error with https://github.com/duniter/cesium.
Maybe it can be a cause of your issue with NextCloud.

ppr

It’s complaining about not having a URL set, yet here it is:

[update]

I used f3 to check whether I might have a bad sd card, but it turns out okay.

[update]

I’ve uploaded a large file too, that seemed to go okay. It went pretty quickly, though sometimes stopped uploading for seconds/minutes before resuming.