FOUND THE SOLUTION for 504 error In the letsencrypt config for nextcloud you need to add   location / { ........ proxy_read_timeout 3600; ........ } I have 3600 for testing purposes. You have to adjust that as you need. By default is 60 somwhere in nginx backend and thats why you get the 504 error after 1 min.