@@ -114,11 +114,45 @@ server {
114114 # End
115115 #####
116116
117+ # Protect NPP runtime files
118+ #################
119+ location ^~ /wp-content/uploads/nginx-cache-purge-preload-runtime/ {
120+ deny all;
121+ access_log off;
122+ log_not_found off;
123+ }
124+ # End
125+ #####
126+
127+ # HTTP Purge - Single
128+ #################
129+ location ~ ^/purge(/.*) {
130+ allow 127.0.0.1;
131+ allow 172.16.0.0/12;
132+ deny all;
133+ fastcgi_cache_purge NPP "$scheme$request_method$host$1";
134+ }
135+ # End
136+ #####
137+
138+ # HTTP Purge - All
139+ #################
140+ location = /purge_all {
141+ allow 127.0.0.1;
142+ allow 172.16.0.0/12;
143+ deny all;
144+
145+ fastcgi_cache NPP;
146+ fastcgi_cache_key "$scheme$request_method$host$request_uri";
147+ fastcgi_cache_purge GET purge_all from all;
148+ }
149+ # End
150+ #####
151+
117152 # WP PHP-FPM PASS
118153 #################
119154 location ~ \.php$ {
120155 # Use NPP "Cache Key Regex" option for non-default structers
121- # This structer supported in default by NPP
122156 ############################################################
123157 fastcgi_cache_key "$scheme$request_method$host$request_uri";
124158 ############################################################
@@ -164,14 +198,6 @@ server {
164198 # End
165199 #####
166200
167- # Protect NPP runtime files
168- #################
169- location ^~ /wp-content/uploads/nginx-cache-purge-preload-runtime/ {
170- deny all;
171- access_log off;
172- log_not_found off;
173- }
174-
175201 # WP Security Settings (Enable on Production)
176202 #################
177203 # Deny access to hidden files and directories (except .well-known)
@@ -258,29 +284,4 @@ server {
258284 #################
259285 add_header NPP-FastCGI-Cache $upstream_cache_status always;
260286 #################
261-
262- # HTTP Purge - Single
263- #################
264- location ~ ^/purge(/.*) {
265- allow 127.0.0.1;
266- allow 172.16.0.0/12;
267- deny all;
268- fastcgi_cache_purge NPP "$scheme$request_method$host$1";
269- }
270- #################
271-
272- # HTTP Purge - All
273- #################
274- location = /purge_all {
275- fastcgi_cache NPP;
276- fastcgi_pass wordpress-fpm:9001;
277- fastcgi_cache_key "$scheme$request_method$host$request_uri";
278-
279- allow 127.0.0.1;
280- allow 172.16.0.0/12;
281- deny all;
282-
283- fastcgi_cache_purge GET purge_all from 127.0.0.1 172.16.0.0/12;
284- }
285- #################
286287}
0 commit comments