# Anything else is dynamically handled by Nextcloud
location ^~ /.well-known { return 301 /index.php$uri; }
#Nextlcoud
server {
listen 443 ssl http2;
server_name site.ru;
keepalive_timeout 70;
ssl_certificate /etc/letsencrypt/live/site.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/site.ru/privkey.pem; # managed by Certbot
# set max upload size and increase upload timeout:
client_max_body_size 7G;
client_body_timeout 300s;
fastcgi_buffers 64 4K;
location / {
location / {
proxy_pass http://localhost:8083;
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_cache off;
# rewrite ^/\.well-known/carddav https://$server_name/remote.php/dav/ redirect;
# rewrite ^/\.well-known/caldav https://$server_name/remote.php/dav/ redirect;
}
}
# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
return 302 /remote.php/webdav/$is_args$args;
}
}
# location = /robots.txt {
# allow all;
# log_not_found off;
# access_log off;
# }
# for `/.well-known`.
location ^~ /.well-known {
# The rules in this block are an adaptation of the rules
# in `.htaccess` that concern `/.well-known`.
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
# Let Nextcloud's API for `/.well-known` URIs handle all other
# requests by passing them to the front-end controller.
return 301 /index.php$request_uri;
}
}