server {
    if ($host = ENDPOINT) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name ENDPOINT;
    return 301 https://$host$request_uri;
}

server {
add_header Strict-Transport-Security max-age=15552000 always;    
listen 0.0.0.0:443 ssl;
server_name ENDPOINT;
ssl_certificate_key /etc/ssl/certs/privkey.key;
ssl_certificate /etc/ssl/certs/fullchain.crt;
ssl_protocols   SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers     HIGH;
#root            /var/www/nextcloud;
proxy_buffering off;
client_max_body_size 10G;
fastcgi_buffers 64 4k;
gzip on;
gzip_min_length 1000;

index index.php;

location = /robots.txt {
allow           all;
log_not_found   off;
}

location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
location / {
        proxy_pass http://127.0.0.1:4010;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size 1G;
	proxy_read_timeout 120;
}
}