From 50c40c58b3f1e33ac35cc5007021536116fb2974 Mon Sep 17 00:00:00 2001 From: Matthew Inamdar Date: Fri, 3 Apr 2020 19:36:37 +0100 Subject: [PATCH] Update server-locations.conf --- .bp-config/nginx/server-locations.conf | 62 +++++++++++--------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/.bp-config/nginx/server-locations.conf b/.bp-config/nginx/server-locations.conf index 359f0ae9..51515e28 100644 --- a/.bp-config/nginx/server-locations.conf +++ b/.bp-config/nginx/server-locations.conf @@ -1,41 +1,33 @@ +# Charset +charset utf-8; - # PHP-FPM monitoring - location ~ ^/_php-fpm/(status|ping)$ { - access_log off; - log_not_found off; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_pass php_fpm; - } +# favicon.ico and robots.txt +location = /favicon.ico { log_not_found off; access_log off; } +location = /robots.txt { log_not_found off; access_log off; } - # Some basic cache-control for static files to be sent to the browser - location ~* \.(?:ico|css|js|gif|jpeg|jpg|png)$ { - expires max; - add_header Pragma public; - add_header Cache-Control "public, must-revalidate, proxy-revalidate"; - } +# PHP-FPM monitoring +location ~ ^/_php-fpm/(status|ping)$ { + access_log off; + log_not_found off; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_pass php_fpm; +} - # Deny hidden files (.htaccess, .htpasswd, .DS_Store). - location ~ /\. { - deny all; - access_log off; - log_not_found off; - } +# PHP rules +location / { + try_files $uri $uri/ /index.php$is_args$args; +} - location / { - try_files $uri $uri/ /index.php$is_args$args; - } +location ~ \.php$ { + try_files $uri =404; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_pass php_fpm; +} - location ~ .*\.php$ { - try_files $uri =404; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_pass php_fpm; - } +error_page 404 /index.php; - # support folder redirects with and without trailing slashes - location ~ "^(.*)[^/]$" { - if (-d $document_root$uri) { - rewrite ^ $redirect_scheme://$http_host$uri/ permanent; - } - } +location ~ /\.ht { + deny all; +}