server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name cloud.[DOMAIN]; ssl_certificate /etc/letsencrypt/live/[DOMAIN]/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/[DOMAIN]/privkey.pem; client_max_body_size 0; underscores_in_headers on; location / { proxy_pass http://nextcloud:80; proxy_set_header Host $http_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; proxy_set_header X-Forwarded-Host $http_host; proxy_set_header X-Forwarded-Ssl on; proxy_redirect off; proxy_buffering off; proxy_request_buffering off; proxy_max_temp_file_size 0; proxy_read_timeout 3600; proxy_send_timeout 3600; } location = /.well-known/carddav { return 301 https://$http_host/remote.php/dav; } location = /.well-known/caldav { return 301 https://$http_host/remote.php/dav; } location = /.well-known/webfinger { return 301 https://$http_host/index.php/.well-known/webfinger; } location = /.well-known/nodeinfo { return 301 https://$http_host/index.php/.well-known/nodeinfo; } }