From ba79f952cfe1f2613e4bdc9a95a53ea4266d93ee Mon Sep 17 00:00:00 2001 From: Stefan Wieczorek Date: Wed, 29 Jun 2022 15:25:59 +0200 Subject: [PATCH] . --- v2/Drupal/Drupal 8 | 27 +++++++++++++++++++++++++-- v2/Drupal/Drupal 9 | 27 +++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/v2/Drupal/Drupal 8 b/v2/Drupal/Drupal 8 index 6bae539..09ab440 100755 --- a/v2/Drupal/Drupal 8 +++ b/v2/Drupal/Drupal 8 @@ -21,9 +21,32 @@ server { allow all; } + location ~ (^|/)\. { + return 403; + } + {{settings}} - try_files $uri $uri/ /index.php?$args; + location ~ ^/sites/.*/files/styles/ { + try_files $uri @rewrite; + } + + location / { + try_files $uri /index.php?$query_string; + } + + location @rewrite { + rewrite ^/(.*)$ /index.php?q=$1; + } + + location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7 + try_files $uri /index.php?$query_string; + } + + if ($request_uri ~* "^(.*/)index\.php/(.*)") { + return 307 $1$2; + } + index index.php index.html; location ~ \.php$ { @@ -39,7 +62,7 @@ server { fastcgi_param PHP_VALUE "{{php_settings}}"; } - location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ { + location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|ico|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ { add_header Access-Control-Allow-Origin "*"; expires max; access_log off; diff --git a/v2/Drupal/Drupal 9 b/v2/Drupal/Drupal 9 index 048527a..dcb4588 100755 --- a/v2/Drupal/Drupal 9 +++ b/v2/Drupal/Drupal 9 @@ -21,9 +21,32 @@ server { allow all; } + location ~ (^|/)\. { + return 403; + } + {{settings}} - try_files $uri $uri/ /index.php?$args; + location ~ ^/sites/.*/files/styles/ { + try_files $uri @rewrite; + } + + location / { + try_files $uri /index.php?$query_string; + } + + location @rewrite { + rewrite ^/(.*)$ /index.php?q=$1; + } + + location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7 + try_files $uri /index.php?$query_string; + } + + if ($request_uri ~* "^(.*/)index\.php/(.*)") { + return 307 $1$2; + } + index index.php index.html; location ~ \.php$ { @@ -39,7 +62,7 @@ server { fastcgi_param PHP_VALUE "{{php_settings}}"; } - location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ { + location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|ico|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf)$ { add_header Access-Control-Allow-Origin "*"; expires max; access_log off;