Skip to content

Commit

Permalink
v6.14
Browse files Browse the repository at this point in the history
+ DietPi-Software | Nextcloud: Update Nginx config file according to official recommendations: nextcloud/documentation#786
  • Loading branch information
MichaIng authored Aug 16, 2018
1 parent c07da18 commit 304567f
Showing 1 changed file with 39 additions and 41 deletions.
80 changes: 39 additions & 41 deletions dietpi/conf/nginx.sites-dietpi.nextcloud.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,65 +29,63 @@ location ^~ /nextcloud {
error_page 404 /nextcloud/core/templates/404.php;

location /nextcloud {
rewrite ^ /nextcloud/index.php$uri;
rewrite ^ /nextcloud/index.php$request_uri;
}

location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
deny all;
}

location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
deny all;
}

location ~ ^/nextcloud/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
# HTTPS forces redirection from http://, thus has to be enabled only on active HTTPS environment.
#fastcgi_param HTTPS on;
# Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
# Front controller enables pretty URLs without /index.php/, which works fine since Nextcloud 13!
fastcgi_param front_controller_active true;
fastcgi_pass php;
fastcgi_intercept_errors on;
# Disable on Jessie, because Jessie Nginx does not support that parameter
#fastcgi_request_buffering off;
# Hard coding 128M OPCache size, only for /nextcloud, to suppress warning on nextcloud admin panel.
fastcgi_param PHP_ADMIN_VALUE "opcache.memory_consumption=128";
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
# HTTPS forces redirection from http://, thus has to be enabled only on active HTTPS environment.
#fastcgi_param HTTPS on;
# Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
# Front controller enables pretty URLs without /index.php/, which works fine since Nextcloud 13!
fastcgi_param front_controller_active true;
fastcgi_pass php;
fastcgi_intercept_errors on;
# Disable on Jessie, because Jessie Nginx does not support that parameter
#fastcgi_request_buffering off;
# Hard coding 128M OPCache size, only for /nextcloud, to suppress warning on nextcloud admin panel.
fastcgi_param PHP_ADMIN_VALUE "opcache.memory_consumption=128";
}

location ~ ^/nextcloud/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
try_files $uri/ =404;
index index.php;
}

# Adding the cache control header for js and css files
# Make sure it is BELOW the PHP block
location ~ \.(?:css|js|woff|svg|gif)$ {
try_files $uri /nextcloud/index.php$uri$is_args$args;
add_header Cache-Control "public, max-age=15778463";
# Add headers to serve security related headers (It is intended
# to have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read
# into this topic first.
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
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-Frame-Options "SAMEORIGIN";
add_header X-Permitted-Cross-Domain-Policies none;
# Optional: Don't log access to assets
access_log off;
try_files $uri /nextcloud/index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
# Add headers to serve security related headers (It is intended
# to have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read
# into this topic first.
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
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-Frame-Options "SAMEORIGIN";
add_header X-Permitted-Cross-Domain-Policies none;
# Optional: Don't log access to assets
access_log off;
}

location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /nextcloud/index.php$uri$is_args$args;
# Optional: Don't log access to other assets
access_log off;
try_files $uri /nextcloud/index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}

}

0 comments on commit 304567f

Please sign in to comment.