Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 35 additions & 34 deletions nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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";
############################################################
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
#################
}
Loading