60 seconds delay when using Nginx reverse proxy

After fixing together a Docker stack based on I’ve been struggling with accessing Nextcloud through a nginx reverse proxy. When I hit up the URL it takes a full 60 seconds before the requests are completed. Does anyone have any idea what could cause this delay? There is no delay whatsoever when I access the containers port directly, using the server IP and port.

In the logs below you can see my initial refresh of the page over https at 22:21:15, after which the next event that occurs happens at 22:22:15, exactly a minute later. When I check for any events in my nginx error log at that time, the following occurs (ignore the hour difference).

2019/06/29 00:22:15 [error] 5749#0: *45 upstream timed out (110: Connection timed out) while reading response header from upstream, client: <IP>, server: cloud.example.com, request: "GET /apps/files/ HTTP/2.0", upstream: "http://[::1]:<port>/apps/files/", host: "cloud.example.com"

I have multiple other services running on the same machine that use the identical nginx settings that work just fine, this issue only occurs with Nextcloud ( v16.0.1).

I’ve attached the container logs, nginx configuration and the docker-compose for the stack below. If anything else is needed, please let me know and I’ll provide it.

Logs:

10.255.0.2 - - [28/Jun/2019:22:21:15 +0000] "GET / HTTP/1.1" 302 898 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:15 +0000] "GET /apps/files/ HTTP/1.1" 200 8654 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /custom_apps/drawio/css/main.css?v=eddc808c-9 HTTP/1.1" 200 393 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /custom_apps/extract/css/style.css?v=62abc69f-9 HTTP/1.1" 200 292 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_rightclick/css/app.css?v=1be355f4-9 HTTP/1.1" 200 479 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_pdfviewer/css/style.css?v=35c36e89-9 HTTP/1.1" 200 522 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/gallery/css/slideshow.css?v=2299cdf0-9 HTTP/1.1" 200 1592 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/gallery/css/share.css?v=2299cdf0-9 HTTP/1.1" 200 1595 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/gallery/css/gallerybutton.css?v=2299cdf0-9 HTTP/1.1" 200 1077 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files/img/app.svg?v=eec9cb9e HTTP/1.1" 200 454 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/gallery/img/app.svg?v=eec9cb9e HTTP/1.1" 200 803 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/activity/img/activity.svg?v=eec9cb9e HTTP/1.1" 200 449 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /settings/img/admin.svg?v=eec9cb9e HTTP/1.1" 200 468 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /settings/img/apps.svg?v=eec9cb9e HTTP/1.1" 200 396 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/files/39b9-9536-merged.css?v=fd2f71d60092c27ca93f3deb9ce568cd-39b92f95-9 HTTP/1.1" 200 6476 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/files_texteditor/0577-9536-merged.css?v=fd2f71d60092c27ca93f3deb9ce568cd-05770f32-9 HTTP/1.1" 200 2329 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/activity/062a-9536-style.css?v=fd2f71d60092c27ca93f3deb9ce568cd-062af747-9 HTTP/1.1" 200 2184 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/core/3a76-9536-results.css?v=fd2f71d60092c27ca93f3deb9ce568cd-eec9cb9e-9 HTTP/1.1" 200 1559 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/core/3a76-9536-css-variables.css?v=fd2f71d60092c27ca93f3deb9ce568cd-eec9cb9e-9 HTTP/1.1" 200 1496 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/img/actions/logout.svg?v=eec9cb9e HTTP/1.1" 200 575 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/img/actions/delete.svg HTTP/1.1" 304 124 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/notifications/12a4-9536-styles.css?v=fd2f71d60092c27ca93f3deb9ce568cd-12a43319-9 HTTP/1.1" 200 1931 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/icons/icons-vars.css?v=1561760536 HTTP/1.1" 200 21401 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /avatar/dan/32?v=0 HTTP/1.1" 304 228 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /settings/img/help.svg?v=eec9cb9e HTTP/1.1" 200 752 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /settings/img/users.svg?v=eec9cb9e HTTP/1.1" 200 1071 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /custom_apps/ransomware_detection/img/app.svg?v=eec9cb9e HTTP/1.1" 200 1500 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/firstrunwizard/img/info.svg?v=eec9cb9e HTTP/1.1" 200 762 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /css/core/3a76-9536-server.css?v=fd2f71d60092c27ca93f3deb9ce568cd-eec9cb9e-9 HTTP/1.1" 200 20370 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/js/backgroundjobs.js?v=eec9cb9e-9 HTTP/1.1" 200 886 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /custom_apps/drawio/js/main.js?v=eec9cb9e-9 HTTP/1.1" 200 1898 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/search/js/search.js?v=eec9cb9e-9 HTTP/1.1" 200 1931 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/js/dist/share_backend.js?v=eec9cb9e-9 HTTP/1.1" 200 22302 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/js/files/client.js?v=eec9cb9e-9 HTTP/1.1" 200 5942 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_sharing/js/dist/files_sharing.js?v=eec9cb9e-9 HTTP/1.1" 200 4144 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_sharing/js/dist/collaboration.js?v=eec9cb9e-9 HTTP/1.1" 200 972 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_trashbin/js/files_trashbin.js?v=eec9cb9e-9 HTTP/1.1" 200 5668 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_videoplayer/js/main.js?v=eec9cb9e-9 HTTP/1.1" 200 2959 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/comments/js/comments.js?v=eec9cb9e-9 HTTP/1.1" 200 20571 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/search/js/searchprovider.js?v=eec9cb9e-9 HTTP/1.1" 200 3994 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /custom_apps/groupfolders/build/files.js?v=eec9cb9e-9 HTTP/1.1" 200 2294 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /custom_apps/extract/js/extraction.js?v=eec9cb9e-9 HTTP/1.1" 200 1375 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_versions/js/files_versions.js?v=eec9cb9e-9 HTTP/1.1" 200 6361 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /js/activity/activity-sidebar.js?v=eec9cb9e-9 HTTP/1.1" 200 6092 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_sharing/js/dist/additionalScripts.js?v=eec9cb9e-9 HTTP/1.1" 200 7674 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_rightclick/js/files.js?v=eec9cb9e-9 HTTP/1.1" 200 1555 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_pdfviewer/js/previewplugin.js?v=eec9cb9e-9 HTTP/1.1" 200 2369 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_texteditor/build/editor.js?v=eec9cb9e-9 HTTP/1.1" 200 6077 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/js/files/fileinfo.js?v=eec9cb9e-9 HTTP/1.1" 200 1177 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/files_rightclick/js/script.js?v=eec9cb9e-9 HTTP/1.1" 200 3352 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/federatedfilesharing/js/external.js?v=eec9cb9e-9 HTTP/1.1" 200 2072 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/recommendations/js/main.js?v=eec9cb9e-9 HTTP/1.1" 200 33288 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/notifications/js/notifications.js?v=eec9cb9e-9 HTTP/1.1" 200 74331 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/js/dist/main.js?v=eec9cb9e-9 HTTP/1.1" 200 370496 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /js/core/merged-template-prepend.js?v=eec9cb9e-9 HTTP/1.1" 200 24312 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/js/dist/systemtags.js?v=eec9cb9e-9 HTTP/1.1" 200 7305 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/systemtags/js/systemtags.js?v=eec9cb9e-9 HTTP/1.1" 200 6502 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/firstrunwizard/js/about.js?v=eec9cb9e-9 HTTP/1.1" 200 583 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /js/files/merged-index.js?v=eec9cb9e-9 HTTP/1.1" 200 90983 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /js/gallery/scripts-for-file-app.js?v=eec9cb9e-9 HTTP/1.1" 200 57044 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/viewer/js/viewer.js?v=eec9cb9e-9 HTTP/1.1" 200 56630 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/notifications/img/notifications.svg HTTP/1.1" 304 125 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/accessibility/js/accessibility?v=0 HTTP/1.1" 200 1003 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/theming/js/theming?v=9 HTTP/1.1" 200 1171 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 699 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/fonts/Nunito-Regular.woff2 HTTP/1.1" 200 19807 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/fonts/Nunito-Bold.woff2 HTTP/1.1" 200 19955 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /core/img/logo/logo.png?v=9 HTTP/1.1" 200 3801 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/gallery/config?extramediatypes=1 HTTP/1.1" 200 993 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/drawio/ajax/settings HTTP/1.1" 200 1060 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /core/img/breadcrumb.svg?v=1 HTTP/1.1" 304 124 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /cron.php HTTP/1.1" 200 875 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:20 +0000] "GET /apps/theming/styles?v=9 HTTP/1.1" 200 1447 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "PROPFIND /remote.php/dav/files/dan/ HTTP/1.1" 207 54228 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /ocs/v2.php/core/whatsnew?format=json HTTP/1.1" 204 573 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /svg/core/logo/logo?color=fff&v=1 HTTP/1.1" 200 1241 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2F HTTP/1.1" 200 1105 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /core/preview?fileId=11&c=cc16755d3e7a887bc05be3e689eee45c&x=250&y=250&forceIcon=0 HTTP/1.1" 200 31267 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/groupfolders/folder-group.svg?v=9 HTTP/1.1" 200 2528 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/core/filetypes/package-x-generic.svg?v=9 HTTP/1.1" 200 1260 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/core/filetypes/image.svg?v=9 HTTP/1.1" 200 1381 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/core/filetypes/file.svg?v=9 HTTP/1.1" 200 1256 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/core/filetypes/text-code.svg?v=9 HTTP/1.1" 200 1285 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/core/filetypes/text.svg?v=9 HTTP/1.1" 200 1323 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/core/filetypes/folder.svg?v=9 HTTP/1.1" 200 1285 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:21 +0000] "GET /apps/theming/img/core/filetypes/application-pdf.svg?v=9 HTTP/1.1" 200 1715 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:22 +0000] "GET /apps/systemtags/lastused HTTP/1.1" 200 891 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"
10.255.0.2 - - [28/Jun/2019:22:22:22 +0000] "GET /apps/recommendations/api/recommendations HTTP/1.1" 200 2146 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0"

docker-compose:

version: '3.2'

services:
db:
    image: mariadb
    restart: always
    volumes:
    - db:/var/lib/mysql
    env_file: <location>/env/nextcloud.env
    networks:
    - cloud

redis:
    image: redis:alpine
    restart: always
    volumes:
    - redis:/data
    networks:
    - cloud

nextcloud:
    image: nextcloud
    restart: always
    ports:
    - 9001:80
    volumes:
    - nextcloud:/var/www/html
    - nextcloud_data:/var/www/html/data
    env_file: <location>/env/nextcloud.env
    environment:
    - MYSQL_HOST=db
    - REDIS_HOST=redis
    networks:
    - cloud
    depends_on:
    - db
    - redis

cron:
    image: nextcloud
    restart: always
    user: www-data
    volumes:
    - nextcloud:/var/www/html
    - nextcloud_data:/var/www/html/data
    entrypoint: /cron.sh
    networks:
    - cloud
    depends_on:
    - nextcloud
    - db

db_backup:
    image: mariadb
    volumes:
    - db_dump:/dump
    - /etc/localtime:/etc/localtime:ro
    env_file: <location>/env/nextcloud-db-dump.env
    entrypoint: |
    bash -c 'bash -s <<EOF
    trap "break;exit" SIGHUP SIGINT SIGTERM
    sleep 2m
    while /bin/true; do
        mysqldump -h db --all-databases | gzip -c > /dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.sql.gz
        (ls -t /dump/dump*.sql.gz|head -n $$BACKUP_NUM_KEEP;ls /dump/dump*.sql.gz)|sort|uniq -u|xargs rm -- {}
        sleep $$BACKUP_FREQUENCY
    done
    EOF'
    networks:
    - cloud
    depends_on:
    - db

volumes:
nextcloud_data:
    driver: local
    driver_opts:
    o: bind
    type: none
    device: <location>

nextcloud:
    driver: local
    driver_opts:
    o: bind
    type: none
    device: <location>

redis:
    driver: local
    driver_opts:
    o: bind
    type: none
    device: <location>

db:
    driver: local
    driver_opts:
    o: bind
    type: none
    device: <location>

db_dump:
    driver: local
    driver_opts:
    o: bind
    type: none
    device: <location>


networks:
cloud:
    driver: overlay
    ipam:
    config:
        - subnet: 172.10.0.0/16

cloud.domain.conf

upstream nextcloud {
    server localhost:<port>;
}

server {
        listen 80;
        listen [::]:80;
        server_name cloud.example.com www.cloud.example.com;
        return 301 https://$host$request_uri;
}
server {
        listen 443 ssl http2;
        server_name cloud.example.com www.cloud.example.com;
        include common.conf;

        location / {
                proxy_pass http://nextcloud/;

                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;

                add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
                client_max_body_size 0;

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

common.conf

ssl_certificate /etc/letsencrypt/live/<domain>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<domain>/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
add_header Strict-Transport-Security "max-age=31536000" always;

Does anyone have any ideas? I also forgot to include the nextcloud configuration, find that below.

<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
    0 =>
    array (
    'path' => '/var/www/html/apps',
    'url' => '/apps',
    'writable' => false,
    ),
    1 =>
    array (
    'path' => '/var/www/html/custom_apps',
    'url' => '/custom_apps',
    'writable' => true,
    ),
),
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
    'host' => 'redis',
    'port' => 6379,
),
'instanceid' => 'oc9qde3z82zp',
'passwordsalt' => '<salt>',
'secret' => '<secret>',
'trusted_domains' =>
array (
    0 => '10.0.1.1:<port>',
    1 => 'cloud.example.com',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'mysql',
'version' => '16.0.1.1',
'overwrite.cli.url' => 'http://10.0.1.1:<port>',
'dbname' => 'nextcloud',
'dbhost' => 'db',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => '<password>',
'installed' => true,
);

I am observing the exact same behavior, and I wonder :thinking: why no one has this problem than us.

I am not sure but I could guess that the service is not ready when you hit the nginx with the first request. As a result nginx will block all further requests for a set time (normally thats 10 seconds, I don’t know why its 60 seconds in your case, maybe some global gonfig somewhere).

In order to fix that try instead of:

upstream nextcloud {
    server localhost:<port>;
}

the following:

upstream nextcloud {
    server localhost:<port> max_fails=0 fail_timeout=0;
}