From ece6ff3ceed28e521bf939444bbb7fe9c1a573aa Mon Sep 17 00:00:00 2001 From: Stefan Wieczorek Date: Tue, 19 Apr 2022 07:58:37 +0200 Subject: [PATCH] . --- v2/Nextcloud/Nextcloud 23 | 21 ++++------ v2/Nextcloud/Nextcloud 24 | 84 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 13 deletions(-) create mode 100755 v2/Nextcloud/Nextcloud 24 diff --git a/v2/Nextcloud/Nextcloud 23 b/v2/Nextcloud/Nextcloud 23 index bc07337..acc2692 100755 --- a/v2/Nextcloud/Nextcloud 23 +++ b/v2/Nextcloud/Nextcloud 23 @@ -1,4 +1,4 @@ -#{"rootDirectory":"","phpVersion":"8.0"} +#{"rootDirectory":"public","phpVersion":"8.0"} server { listen 80; listen [::]:80; @@ -16,21 +16,16 @@ server { rewrite ^ https://$host$uri permanent; } - location ~ /.well-known { + location ^~ /.well-known { + + location = /.well-known/carddav { return 301 /remote.php/dav/; } + location = /.well-known/caldav { return 301 /remote.php/dav/; } + location ^~ /.well-known { return 301 /index.php$uri; } + try_files $uri $uri/ =404; auth_basic off; allow all; } - {{settings}} - - location = /.well-known/carddav { - return 301 $scheme://$host:$server_port/remote.php/dav; - } - - location = /.well-known/caldav { - return 301 $scheme://$host:$server_port/remote.php/dav; - } - location / { rewrite ^ /index.php; } @@ -46,7 +41,7 @@ server { try_files $uri $uri/ /index.php?$args; index index.php index.html; - location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) { + location ~ ^\/(?:index|setup-nextcloud|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) { include fastcgi_params; fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; set $path_info $fastcgi_path_info; diff --git a/v2/Nextcloud/Nextcloud 24 b/v2/Nextcloud/Nextcloud 24 new file mode 100755 index 0000000..3fdc4e9 --- /dev/null +++ b/v2/Nextcloud/Nextcloud 24 @@ -0,0 +1,84 @@ +#{"rootDirectory":"public","phpVersion":"8.1"} +server { + listen 80; + listen [::]:80; + listen 443 ssl http2; + listen [::]:443 ssl http2; + {{ssl_certificate_key}} + {{ssl_certificate}} + {{server_name}} + {{root}} + + {{nginx_access_log}} + {{nginx_error_log}} + + if ($scheme != "https") { + rewrite ^ https://$host$uri permanent; + } + + location ^~ /.well-known { + location = /.well-known/carddav { return 301 /remote.php/dav/; } + location = /.well-known/caldav { return 301 /remote.php/dav/; } + location ^~ /.well-known { return 301 /index.php$uri; } + try_files $uri $uri/ =404; + auth_basic off; + allow all; + } + + location / { + rewrite ^ /index.php; + } + + location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { + deny all; + } + + location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) { + deny all; + } + + try_files $uri $uri/ /index.php?$args; + index index.php index.html; + + location ~ ^\/(?:index|setup-nextcloud|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) { + include fastcgi_params; + fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; + set $path_info $fastcgi_path_info; + try_files $fastcgi_script_name =404; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + fastcgi_param front_controller_active true; + fastcgi_read_timeout 3600; + fastcgi_send_timeout 3600; + fastcgi_pass 127.0.0.1:{{php_fpm_port}}; + fastcgi_param PHP_VALUE "{{php_settings}}"; + } + + location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) { + try_files $uri/ =404; + index index.php; + } + + location ~ \.(?:css|js|woff2?|svg|gif|map)$ { + try_files $uri /index.php$request_uri; + add_header Cache-Control "public, max-age=15778463"; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header X-Download-Options noopen; + add_header X-Permitted-Cross-Domain-Policies none; + add_header Referrer-Policy no-referrer; + # Optional: Don't log access to assets + access_log off; + } + + location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + try_files $uri /index.php$request_uri; + # Optional: Don't log access to other assets + access_log off; + } + + if (-f $request_filename) { + break; + } +} \ No newline at end of file