diff --git a/nginx/default.conf b/nginx/default.conf index 7b2d83c..1b3eabe 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -114,11 +114,45 @@ server { # End ##### + # Protect NPP runtime files + ################# + location ^~ /wp-content/uploads/nginx-cache-purge-preload-runtime/ { + deny all; + access_log off; + log_not_found off; + } + # End + ##### + + # HTTP Purge - Single + ################# + location ~ ^/purge(/.*) { + allow 127.0.0.1; + allow 172.16.0.0/12; + deny all; + fastcgi_cache_purge NPP "$scheme$request_method$host$1"; + } + # End + ##### + + # HTTP Purge - All + ################# + location = /purge_all { + allow 127.0.0.1; + allow 172.16.0.0/12; + deny all; + + fastcgi_cache NPP; + fastcgi_cache_key "$scheme$request_method$host$request_uri"; + fastcgi_cache_purge GET purge_all from all; + } + # End + ##### + # WP PHP-FPM PASS ################# location ~ \.php$ { # Use NPP "Cache Key Regex" option for non-default structers - # This structer supported in default by NPP ############################################################ fastcgi_cache_key "$scheme$request_method$host$request_uri"; ############################################################ @@ -164,14 +198,6 @@ server { # End ##### - # Protect NPP runtime files - ################# - location ^~ /wp-content/uploads/nginx-cache-purge-preload-runtime/ { - deny all; - access_log off; - log_not_found off; - } - # WP Security Settings (Enable on Production) ################# # Deny access to hidden files and directories (except .well-known) @@ -258,29 +284,4 @@ server { ################# add_header NPP-FastCGI-Cache $upstream_cache_status always; ################# - - # HTTP Purge - Single - ################# - location ~ ^/purge(/.*) { - allow 127.0.0.1; - allow 172.16.0.0/12; - deny all; - fastcgi_cache_purge NPP "$scheme$request_method$host$1"; - } - ################# - - # HTTP Purge - All - ################# - location = /purge_all { - fastcgi_cache NPP; - fastcgi_pass wordpress-fpm:9001; - fastcgi_cache_key "$scheme$request_method$host$request_uri"; - - allow 127.0.0.1; - allow 172.16.0.0/12; - deny all; - - fastcgi_cache_purge GET purge_all from 127.0.0.1 172.16.0.0/12; - } - ################# }