1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

Update nginx.conf

This commit is contained in:
Éric Gaspar 2023-10-24 17:32:53 +02:00
parent 8558d812d5
commit 2699202daf

View file

@ -1,3 +1,9 @@
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ^~ /.well-known {
# The following 6 rules are borrowed from `.htaccess`
@ -23,7 +29,7 @@ location ^~ __PATH__/ {
# Path to source
alias __INSTALL_DIR__/;
# Set max upload size
# set max upload size and increase upload timeout:
client_max_body_size 10G;
client_body_timeout 300s;
fastcgi_buffers 64 4K;
@ -45,7 +51,7 @@ location ^~ __PATH__/ {
# for tunning hints
client_body_buffer_size 512k;
# Add headers to serve security related headers
# HTTP response headers borrowed from Nextcloud `.htaccess`
more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;";
more_set_headers "Referrer-Policy: no-referrer";
more_set_headers "X-Content-Type-Options: nosniff";
@ -77,12 +83,6 @@ location ^~ __PATH__/ {
}
}
location = __PATH__/robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
@ -93,8 +93,6 @@ location ^~ __PATH__/ {
# `/nextcloud/index.php` to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
# Required for legacy support
# https://github.com/nextcloud/documentation/pull/2197#issuecomment-721432337
# This line fix the ldap admin page
rewrite ^__PATH__/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy) __PATH__/index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
@ -111,6 +109,7 @@ location ^~ __PATH__/ {
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_param HTTP_ACCEPT_ENCODING ""; # Disable encoding of nextcloud response to inject ynh scripts
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
@ -130,7 +129,7 @@ location ^~ __PATH__/ {
location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map)$ {
try_files $uri / __PATH__/index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
more_set_headers "Cache-Control: public, max-age=15778463, $asset_immutable";
access_log off; # Optional: Don't log access to assets
location ~ \.wasm$ {
@ -144,6 +143,11 @@ location ^~ __PATH__/ {
access_log off; # Optional: Don't log access to assets
}
# Rule borrowed from `.htaccess`
location __PATH__/remote {
return 301 __PATH__/remote.php$request_uri;
}
location ~ / {
if ($request_method ~ ^(PUT|DELETE|PATCH)$) {
rewrite ^ __PATH__/index.php$request_uri last;