frickle / ngx_cache_purge Goto Github PK
View Code? Open in Web Editor NEWnginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches.
Home Page: http://labs.frickle.com/nginx_ngx_cache_purge/
License: Other
nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches.
Home Page: http://labs.frickle.com/nginx_ngx_cache_purge/
License: Other
I have integrated the module with Nginx 1.6.2 in this project.
I build the project with this helper command:
./bin/build-container.sh
I start the container with Nginx inside with this helper command:
./bin/run-container.sh
Then I add the file into the cache with:
$ curl -i localhost:8080/test
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Thu, 02 Apr 2015 14:53:57 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 65
Connection: keep-alive
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Cache-Status: MISS
<h1>Current Time Is</h1>
<p>2015.02.04 14:53:57</p>
<p>/test</p>
After requesting it next time I see it's inside the cache (X-Cache-Status: HIT
):
$ curl -i localhost:8080/test
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Thu, 02 Apr 2015 14:54:54 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 65
Connection: keep-alive
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Cache-Status: HIT
<h1>Current Time Is</h1>
<p>2015.02.04 14:53:57</p>
<p>/test</p>
When I try to purge it I get a 404
:
$ curl -i -XPURGE localhost:8080/test
HTTP/1.1 404 Not Found
Server: nginx/1.6.2
Date: Thu, 02 Apr 2015 14:56:17 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.6.2</center>
</body>
</html>
Also the second way to purge doesn't work:
$ docker exec nginx-cache-example curl -i localhost/purge/test
HTTP/1.1 404 Not Found
Server: nginx/1.6.2
Date: Thu, 02 Apr 2015 14:57:47 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.6.2</center>
</body>
</html>
Here is the nginx.conf
which I use.
Hi
Thanks for providing this module. I am just getting started with this module and have a built nginx image with this module. Now, I'm not sure how I would configure the purge to only purge select files - for example by providing a hash/key or something similar, what variables can be used? Thanks
Recent changes to the ngx_http_fastcgi_loc_conf_t structure cause segfaults on newer versions of nginx.
Reference: http://trac.nginx.org/nginx/changeset/f8e80f8c7fc75b6d7caf7812b63a1682c66c5ccb/nginx/
Starting program: /usr/sbin/nginx.debug -t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00000000004d258b in ngx_http_fastcgi_init_params (cf=0x7fffffffe7d0, conf=0x9124e0, params=0x9126a8, default_params=0x0) at src/http/modules/ngx_http_fastcgi_module.c:2853
2853 if (src[i].key.len > sizeof("HTTP_") - 1
(gdb) bt
#0 0x00000000004d258b in ngx_http_fastcgi_init_params (cf=0x7fffffffe7d0, conf=0x9124e0, params=0x9126a8, default_params=0x0) at src/http/modules/ngx_http_fastcgi_module.c:2853
#1 0x00000000004d21b5 in ngx_http_fastcgi_merge_loc_conf (cf=0x7fffffffe7d0, parent=0x8f0720, child=0x9124e0) at src/http/modules/ngx_http_fastcgi_module.c:2731
#2 0x000000000044e133 in ngx_http_merge_locations (cf=0x7fffffffe7d0, locations=0x8967b0, loc_conf=0x8efb28, module=0x73c6a0, ctx_index=24) at src/http/ngx_http.c:650
#3 0x000000000044e00a in ngx_http_merge_servers (cf=0x7fffffffe7d0, cmcf=0x7740c0, module=0x73c6a0, ctx_index=24) at src/http/ngx_http.c:607
#4 0x000000000044d4ba in ngx_http_block (cf=0x7fffffffe7d0, cmd=0x72eca0, conf=0x773498) at src/http/ngx_http.c:270
#5 0x00000000004241db in ngx_conf_handler (cf=0x7fffffffe7d0, last=1) at src/core/ngx_conf_file.c:391
#6 0x0000000000423d8a in ngx_conf_parse (cf=0x7fffffffe7d0, filename=0x772750) at src/core/ngx_conf_file.c:247
#7 0x0000000000420932 in ngx_init_cycle (old_cycle=0x7fffffffe910) at src/core/ngx_cycle.c:264
#8 0x00000000004081d8 in main (argc=2, argv=0x7fffffffebf8) at src/core/nginx.c:333
I am working on Nginx , used Nginx cache,Now I want to purge this cache based on partial cache key, so I had use ngx_cache_purge module of Nginx I have the following code:
proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache:60m max_size=1G;
server {
listen 8888;
server_name localhost;
location / {
add_header X-nginx-Cache $upstream_cache_status;
proxy_cache cache;
proxy_cache_key $request_uri$http_x_authorization;
proxy_pass_request_headers on;
proxy_cache_valid 200 302 10m;
proxy_pass http://localhost:9000;
proxy_cache_purge PURGE from 127.0.0.1;
}
}
I want to purge cache based on request_uri which is also a part of cache_key, I dont want to worry about http_x_authorization because it is a token from authorization framework,which is hard to remember
I tried with curl command :
curl -X PURGE --header"X-Authorization: AQIC5wM2LY4SfcwJgt8XkeCFGdA48S48lm8iR8kCtHZJ5Vc." http://127.0.0.1:8888/api/find/bid/20
this is working, but if I do purge with request_uri this doesn't work
curl -X PURGE http://127.0.0.1:8888/api/find/bid/20
Should ngx_cache_purge always requires full key ?
Please suggest
Thanks
If you are using Vary
, you might purge a specific variant, but that variant may still be present in the cache and served to clients.
In this example, the following sequence of requests is made for the Waifu: Mokou
variant:
GET (MISS)
GET (HIT)
PURGE (404)
GET (HIT)
In this example, the following sequence of requests is made for the Waifu: Mokou
variant:
GET (MISS)
GET (HIT)
GET (MISS)
PURGE (200)
GET (HIT)
Both of these tests "pass" over here on OSX 10.12.1 with nginx 1.9.15 and ngx_cache_purge 2.3.
Hello ,
i have WordPress website with arabic urls , whenever i try to purge link it says 404 not found !
anyway i tested English urls and it works fine !
why the plugin have problems with different language ?
Hi!
When using 'fastcgi_cache_use_stale updating' we can rely on serving and expired cache while the upstream builds a fresh new copy.
But if we delete the cache, there is no expired resource... of course, there is just nothing.
Imagine the situation in which you have a very active site, think a news site, and suddenly you experience a huge traffic spike. If we are serving fastcgi cached pages, everything goes well.
But if editors update the content the cache gets purged (deleted), and every subsequent request go straight to the upstream (if using php5-fpm you can see an army of new processes firing up). If you are lucky everything would normalize in a while... If you aren't, it will all go to hell.
But if we have the ability to flag a cache as EXPIRED, we can leverage 'fastcgi_cache_use_stale updating' to serve the old copy while the new one is being built.
What do you guys think?
Hello,
I don't know if it is the best place to report this issue.
I installed debian nginx-extras ( 1.10.3 ) , and it seems to be correctly compiled with this module nginx-cache-purge :
nginx -V 2>&1
nginx version: nginx/1.10.3
built with OpenSSL 1.1.0d 26 Jan 2017 (running with OpenSSL 1.1.0e 16 Feb 2017)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-F3HeH5/nginx-1.10.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/headers-more-nginx-module --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-auth-pam --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules**/nginx-cache-purge** --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-dav-ext-module --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-development-kit --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-echo --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/ngx-fancyindex --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nchan --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-lua --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-upload-progress --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-F3HeH5/nginx-1.10.3/debian/modules/ngx_http_substitutions_filter_module
but , when I start it, I see the following message :
nginx: [emerg] unknown directive "fastcgi_cache_purge" in /etc/nginx/sites-enabled/default.conf:151
I used this repo ( deb http://httpredir.debian.org/debian unstable main ) to install the package using apt-get .
Thank you
sorry if this is the wrong place, I did not find any other where I can submit this issue
i have just installed ngx_cache_purge and am noticing strange behaviour
if entry is not in the cache, I get 404 error, which I guess is OK
if entry is in the cache, I get 500 error and only after few refreshes I get "successfull purge"
i am happy to provide any additional info if this is not the expected result
When I execute purge for a specific page fast_cgi cache is not getting clear.
ex. If I want to clear the fast_cgi cache of test page only - http://www.test.com/purge/test/
Hello !
I have an issue using the module.
The purge URL are working great (200
when file cache exist and deleted, 404
when file cache not exist).
Getting those URL from my browser or Postman purge correctly the cache.
Now, getting the SAME URL from wget/CURL/wp_remote_get()
fail and always throw 404
. This is the exact same URL, tested from same server and other server (wget/curl
).
As seen here i tried to force a user-agent, but still the same. I only have 200 and cache purged when URL is acceded from my browser or postman.
I'm Using HTTP2/HTTPS
latest Nginx. I tried use HTTP2
with wp_remote_get()
without success (header http_version
still 1.1) and with curl --http2
(Goes 404).
All wget/CURL/wp_remote_get()
always goes to 404. Nginx access.log have the GET tracking saved:
(for all test, refreshed cache, checked that file was here and delete was ok from browser GET cache purge URL - 0.0.0.1 is My IP replaced, 0.0.0.2 is Server IP replaced)
Me trying to purge from my browser: OK (200 purge OK)
0.0.0.1 - - [04/Aug/2017:14:42:04 +0200] "GET /purge/alphonse/helene-l/ HTTP/2.0" 200 364 "-" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
Me trying to purge from wp_remote_get() not changing user-agent: NOK (404)
0.0.0.2 - - [04/Aug/2017:14:42:13 +0200] "GET /purge/alphonse/helene-l/ HTTP/1.1" 404 162 "https://domain.com/purge/alphonse/helene-l/" "WordPress/4.8; https://mtx.io"
Me trying to purge from CURL HTTP2 not changing user-agent: NOK (404)
0.0.0.2 - - [04/Aug/2017:15:22:58 +0200] "GET /purge/alphonse/helene-l/ HTTP/2.0" 404 162 "-" "curl/7.52.1"
Me trying to purge from wp_remote_get() changing user-agent: NOK (404)
0.0.0.2 - - [04/Aug/2017:15:19:15 +0200] "GET /purge/alphonse/helene-l/ HTTP/1.1" 404 191 "https://domain.com/purge/alphonse/helene-l/" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
Meaning that the plugin Wordpress Nginx Helper dont work as use wp_remote_get()...
Anything i'm missing to get the request Work ?
Thanks a looot !
1.0.5 includes fixes for critical issues related to cache and config reloads causing self-DoS, so it would be great to have this fixed:
/var/opt/ngx_cache_purge//ngx_cache_purge_module.c: In function ‘ngx_http_file_cache_purge’:
/var/opt/ngx_cache_purge//ngx_cache_purge_module.c:691: error: ‘ngx_http_file_cache_node_t’ has no member named ‘length’
make[1]: **\* [objs/addon/ngx_cache_purge/ngx_cache_purge_module.o] Error 1
make[1]: Leaving directory `/var/opt/nginx-1.0.5'
make: **\* [build] Error 2
I don't see any explanation of how to install this on a server and get it to work with a nginx installation...
ngx_cache_purge/ngx_cache_purge_module.c: In function 'ngx_http_file_cache_purge':
ngx_cache_purge/ngx_cache_purge_module.c:681: error: 'ngx_http_file_cache_node_t' has no member named 'length'
Disclaimer: I read the TODO, but maybe this use case is supported
nginx.conf
fastcgi_cache_key "$host$key_uri$cookie_OctopusCacheID";
so the cache gets keys like
example.com/page-1 # anonymous user / no cookie
example.com/page-1BONDfaa020008474173563121e9163e7cac3 # authenticated user / cookie
For the purge we execute
curl --verbose --header 'Host:example.com' 'http://127.0.0.1:8888/purge/page-1'
But does only clear the first key, not the second one, so to make a long story short, can we do something like
curl --verbose --header 'Host:example.com' 'http://127.0.0.1:8888/purge/page-1**'
The Nginx wiki suggests to have $request_method in the cache key:
Be advised that a HEAD request can cause an empty response to be cached & later be distributed to GET requests, avoid this by having $request_method in the cache key. Including the $scheme for the same reason may be beneficial to avoid serving up pages with insecure content to HTTPS visitors (or vice-versa).
However, this breaks the same location syntax, as it'd be looking for the incorrect cache key (with PURGE as the scheme instead of GET). I'd love to use the same location syntax, but I'm scared to remove $request_method from my cache key, knowing that a HEAD request hitting an uncached page will cache a blank page.
I tried to build with nginx 1.8.0, copying the module's source code from the 1.6.2 package for Debian Jesse.
Regrettably, looks like something's changed in nginx data structures, so the module fails to build with a bunch of warnings and some errors.
Are there any plans to update for 1.8.0?
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c: In function ‘ngx_http_fastcgi_cache_purge_conf’:
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:251:30: warning: comparison between pointer and integer
if (flcf->upstream.cache != NGX_CONF_UNSET_PTR
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:252:33: warning: comparison between pointer and integer
&& flcf->upstream.cache != NULL)
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:268:26: warning: assignment makes integer from pointer without a cast
flcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:270:30: warning: comparison between pointer and integer
if (flcf->upstream.cache == NULL) {
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c: In function ‘ngx_http_fastcgi_cache_purge_handler’:
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:301:58: error: invalid type argument of ‘->’ (have ‘int’)
if (ngx_http_cache_purge_init(r, flcf->upstream.cache->data,
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c: In function ‘ngx_http_proxy_cache_purge_conf’:
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:399:30: warning: comparison between pointer and integer
if (plcf->upstream.cache != NGX_CONF_UNSET_PTR
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:400:33: warning: comparison between pointer and integer
&& plcf->upstream.cache != NULL)
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:416:26: warning: assignment makes integer from pointer without a cast
plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:418:30: warning: comparison between pointer and integer
if (plcf->upstream.cache == NULL) {
^
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c: In function ‘ngx_http_proxy_cache_purge_handler’:
/home/kman/src/nginx-1.8.0/debian/modules/nginx-cache-purge/ngx_cache_purge_module.c:449:58: error: invalid type argument of ‘->’ (have ‘int’)
if (ngx_http_cache_purge_init(r, plcf->upstream.cache->data,
It appears that this module compiles fine with 1.4.0 and 1.4.1. The README only reports through 1.3.x. Would be good to update it to know that it is okay.
I'm using this code to this to warm the cache:
location /:cache/warm {
rewrite ^/:cache/warm(/.*)$ $1;
root /home/web;
slowfs_cache sites;
slowfs_cache_key $1;
slowfs_cache_valid 15d;
break;
}
Which works great, but it also returns the entire file. If I want to warm up a lot of large files, this will go much slower.
I tried adding return 200 "ok";
to the location block:
location /:cache/warm {
rewrite ^/:cache/warm(/.*)$ $1;
root /home/web;
slowfs_cache sites;
slowfs_cache_key $1;
slowfs_cache_valid 15d;
return 200 "ok";
break;
}
But when I do this, the file doesn't get cached.
Is there a sneaky way to cache the file without serving it?
Hi ,
I am new to this nginx, I had setup Nginx web server using source code, and then add this ngx_cache-purge module , added following server configuration in nginx.conf file,
server {
listen 8888;
listen 8889 ssl;
server_name localhost;
#charset koi8-r;
access_log /var/log/nginx/localhost.access.log rt_cache;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
location / {
add_header X-nginx-Cache $upstream_cache_status;
proxy_cache cache;
proxy_cache_key $request_uri$http_x_authorization;
proxy_pass_request_headers on;
#proxy_cache_valid 200 302 10m;
proxy_pass http://localhost:9000;
}
location ~/purge(/.*)
{
allow 127.0.0.1;
proxy_cache_purge cache $request_uri$http_x_authorization;
}
now I want to purge cache , how I will verify this purge is working
based on one cache key, or how can I debug this.
please suggest
Thanks
for many months I've been running the config shown here: https://rtcamp.com/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/
This morning, I apt-get upgraded and got nginx 1.7.8 and a load of dead sites. running nginx -t gave me a segmentation fault (core dumped) error.
After a whole load of panicking and commenting one line out at a time, I finally tracked it down to this section:
location ~ /purge(/.*) {
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
}
If I comment that out, I can start up wordpress and nginx -t doesn't core dump.
I posted on the nginx forum at http://forum.nginx.org/read.php?2,255522, and they are suggesting it's definitely a third party module causing it, and linked here.
However, As far as I can see, the nginx-extras package was built 15 hours ago.
Also, from this repo:
2014-12-02 VERSION 2.2
* Fix compatibility with nginx-1.7.8+.
From nginx -V
--add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-cache-purge
I can't see anything obvious in the release notes that would cause this, server details are below:
Linux 3.16.0-28-generic #37-Ubuntu SMP Mon Dec 8 17:22:00 UTC 2014 i686 i686 i686 GNU/Linux
nginx version: nginx/1.7.8
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.7.8/debian/modules/headers-more-nginx-module --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-cache-purge --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-development-kit --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.7.8/debian/modules/ngx-fancyindex --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-http-push --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-lua --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-upload-progress --add-module=/build/buildd/nginx-1.7.8/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.7.8/debian/modules/ngx_http_substitutions_filter_module
if use in config gzip_types
Reading symbols from /usr/sbin/nginx.debug...done.
(gdb) r
Starting program: /usr/sbin/nginx.debug -c /etc/nginx/nginx.conf
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
**__strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:235
235 movdqa (%rdi), %xmm2**
Missing separate debuginfos, use: debuginfo-install audit-libs-2.4.1-5.el7.x86_64 fontconfig-2.10.95-7.el7.x86_64 freetype-2.4.11-11.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.13.2-10.el7.x86_64 libX11-1.6.3-2.el7.x86_64 libXau-1.0.8-2.1.el7.x86_64 libXpm-3.5.11-3.el7.x86_64 libcom_err-1.42.9-7.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libpng-1.5.13-7.el7_2.x86_64 libselinux-2.2.2-6.el7.x86_64 libxcb-1.11-4.el7.x86_64 nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64
(gdb) bt full
#0 __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:235
No locals.
#1 0x000000000042a301 in ngx_conf_handler (last=0, cf=0x7fffffffe150) at src/core/ngx_conf_file.c:309
rv = <optimized out>
conf = <optimized out>
i = 47
confp = <optimized out>
found = 0
name = 0x78b030
cmd = 0x753310 <ngx_http_cache_purge_success_page_top+112>
Hi,
i tryed to install from Sources with your modul but debuild -us -uc gives this erros
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules -I src/mail
-o objs/addon/nginx-cache-purge/ngx_cache_purge_module.o
/home/nginx-cache-purge/ngx_cache_purge_module.c
/home/nginx-cache-purge/ngx_cache_purge_module.c: In function 'ngx_http_fastcgi_cache_purge_conf':
/home/nginx-cache-purge/ngx_cache_purge_module.c:194:30: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:195:33: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:211:26: error: assignment makes integer from pointer without a cast [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:213:30: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c: In function 'ngx_http_fastcgi_cache_purge_handler':
/home/nginx-cache-purge/ngx_cache_purge_module.c:243:58: error: invalid type argument of '->' (have 'int')
/home/nginx-cache-purge/ngx_cache_purge_module.c: In function 'ngx_http_scgi_cache_purge_conf':
/home/nginx-cache-purge/ngx_cache_purge_module.c:415:30: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:416:33: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:432:26: error: assignment makes integer from pointer without a cast [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:434:30: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c: In function 'ngx_http_scgi_cache_purge_handler':
/home/nginx-cache-purge/ngx_cache_purge_module.c:464:58: error: invalid type argument of '->' (have 'int')
/home/nginx-cache-purge/ngx_cache_purge_module.c: In function 'ngx_http_uwsgi_cache_purge_conf':
/home/nginx-cache-purge/ngx_cache_purge_module.c:517:30: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:518:33: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:534:26: error: assignment makes integer from pointer without a cast [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c:536:30: error: comparison between pointer and integer [-Werror]
/home/nginx-cache-purge/ngx_cache_purge_module.c: In function 'ngx_http_uwsgi_cache_purge_handler':
/home/nginx-cache-purge/ngx_cache_purge_module.c:566:58: error: invalid type argument of '->' (have 'int')
cc1: all warnings being treated as errors
make[3]: *** [objs/addon/nginx-cache-purge/ngx_cache_purge_module.o] Error 1
make[3]: Leaving directory /root/nginx-1.8.0' make[2]: *** [build] Error 2 make[2]: Leaving directory
/root/nginx-1.8.0'
dh_auto_build: make -j1 returned exit code 2
make[1]: *** [override_dh_auto_build] Error 2
make[1]: Leaving directory `/root/nginx-1.8.0'
make: *** [build] Error 2
In case the proxy purge or slowfs purge modul does not find a file to delete, an error message like this is written:
2013/12/06 09:31:53 [error] 5399#0: *20150750 open() "/srv/htdocs/purge/o/y/jh/image450x352.jpg" failed (2: No such file or directory), client: 10.172.252.136, server: images.example.de, request: "HEAD /purge/o/y/jh/image450x352.jpg HTTP/1.1", host: "10.1.1.1"
This error is missleading, the modul should catch all request and do not pass the request to the normal nginx file handling...
for example ,how could I do to purge all files under http://ab.c.com/some/ ?
Hi,
how can I add more than one IP Address to
proxy_cache_purge PURGE from xxx.xxx.xxx.xxx;
Thanks!
--- a/ngx_cache_purge_module.c 2012-06-28 05:08:44.000000000 +0800
+++ b/ngx_cache_purge_module.c 2011-12-20 20:36:20.000000000 +0800
@@ -41,7 +41,7 @@ char _ngx_http_fastcgi_cache_purge
ngx_int_t ngx_http_fastcgi_cache_purge_handler(ngx_http_request_t *r);
-# if (NGX_HTTP_PROXY)
+# if (NGX_HTTP_PROXY || nginx_version >= 1003002)
char _ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf,
ngx_command_t *cmd, void *conf);
ngx_int_t ngx_http_proxy_cache_purge_handler(ngx_http_request_t *r);
@@ -76,7 +76,7 @@ static ngx_command_t ngx_http_cache_pur
NULL },
-# if (NGX_HTTP_PROXY)
+# if (NGX_HTTP_PROXY || nginx_version >= 1003002)
{ ngx_string("proxy_cache_purge"),
NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
ngx_http_proxy_cache_purge_conf,
@@ -257,7 +257,7 @@ ngx_http_fastcgi_cache_purge_handler(ngx
}
-# if (NGX_HTTP_PROXY)
+# if (NGX_HTTP_PROXY || nginx_version >= 1003002)
extern ngx_module_t ngx_http_proxy_module;
typedef struct {
it would be a very nice feature to have a URL which would trigger a purge of the whole cache instead of having to purge one page after the other
I'm working with the ngx_page_speed module. And i have essnetially 4 caches for every page, because i have added PS-CapabilityList to my proxy_cache_key. Like this:
# Split caches up by custom capabilities
# explaination here: https://github.com/pagespeed/ngx_pagespeed/issues/1059#issuecomment-162385212
set $default_pscap_for_large_screens "LargeScreen.SkipUADependentOptimizations:";
set $default_pscap_for_small_screens "TinyScreen.SkipUADependentOptimizations:";
set $ps_capability_list $default_pscap_for_large_screens;
if ($http_user_agent ~ "(?i)Chrome/|Firefox/|Gecko|MSIE |Trident|Safari|Wget") {
set $ps_capability_list "ll,ii,dj:";
}
if ($http_user_agent ~ "(?i)Chrome/[2][3-9]+\.|Chrome/[[3-9][0-9]+\.|Chrome/[0-9]{3,}\.") {
set $ps_capability_list "ll,ii,dj,jw,ws:";
}
if ($http_user_agent ~ "(?i)Firefox/[1-2]\.|MSIE [5-8]\.|bot|Yahoo!|Ruby|RPT-HTTPClient|(Google \(\+https\:\/\/developers\.google\.com\/\+\/we$
set $ps_capability_list $default_pscap_for_large_screens;
}
if ($http_user_agent ~ "(?i)Mozilla.*Android.*Mobile*|iPhone|BlackBerry|Opera Mobi|Opera Mini|SymbianOS|UP.Browser|J-PHONE|Profile/MIDP|portal$
set $ps_capability_list $default_pscap_for_small_screens;
}
# Set the proxy cache key
set $cache_key $ps_capability_list$scheme$host$uri$is_args$args;
What i'm wondering is, would it be possible to do a wildcard purge, for example when i want to purge "/" i want to purge it for each of these capabilities as well. so essentially i would need to send 4 requests to purge one page.
would it be possible to do something like:
proxy_cache_purge main _wildcard_$scheme$host$1$is_args$args;
Thanks!
I use CORS which adds the header Vary: Origin.
This doesn't work with the cache purge implementation.
If I turn off CORS it works again.
I wonder what the first line in the cache entry says.
It also contains Origin, vim just outputs this as
^C^@^@^@^@^@^@^@^K▒~DW^@^@^@^@▒▒▒▒▒▒▒▒▒▒~DW^@^@^@^@~C▒Z▒^@^@▒^@
^B^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^FOrigin^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@▒~R▒▒7▒^F▒#^S▒y(,^?▒
ngx_cache_purge doesn't honor server_tokens off. When a purge is successful it shows which version of nginx it's using
The purging page looks like this
Successful purge Key : httpGETmypage.com Path: /var/lib/nginx/tmp/fastcgi_cache/X/XX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX nginx/1.6.0
nginx -V nginx version: nginx/1.6.0 TLS SNI support enabled configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-debug --add-module=/builddir/build/BUILD/nginx-1.6.0/modsecurity-2.8.0/nginx/modsecurity --add-module=/builddir/build/BUILD/nginx-1.6.0/ngx_cache_purge-2.1 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables' --with-ld-opt=-Wl,-E
Is it possible to add support for multiple fastcgi_cache_purge inside one location, barracuda (http:/drupal.org/project/barracuda) uses multiple caches depending on the device, you can find more information at http://drupal.org/node/1329770, but in short we want to be able to do something like this
location ~ /purge(/.*) {
fastcgi_cache_purge speed normal$host$1$is_args$args;
fastcgi_cache_purge speed mobile-other$host$1$is_args$args;
...
}
Following the readme configuration of fastcgi_cache I noticed that purge is not working in case of querystring.
Is there a way to solve this?
Thanks for good work. I have a request from me and many of my readers...
We need a purge ALL option.
Currently we can do...
fastcgi_cache_purge zone_name key
What we need to do....
fastcgi_cache_purge zone_name EVERYTHING
or may be
fastcgi_cache_flush zone_name
Use-case:
We have modified theme or deployed new codes. Entire cache becomes invalid.
As of now we need to do rm -rf
on cache-location which is cumbersome and bit risky.
If a new directive gets added, that will be really helpful.
Hi, How can use PHP code to clear fastcgi_cache file??
Hello,
Nginx will save response to different cache files when Vary: Accept-Encoding is set. That is, one will be uncompressed, other compressed. This module will delete only one version of the file, making it partially usable. This was added in nginx changeset 60fde1bc7236:
http://mailman.nginx.org/pipermail/nginx-devel/2014-October.txt
Changes with nginx 1.7.7 28 Oct 2014
*) Change: now nginx takes into account the "Vary" header line in a
backend response while caching.
Hi there
Thank you for this wonderful module - it's exactly what I need for my shared hosting server having nginx in front of apache caching the proxy_pass. However, I can't figure out how to define the location that can be used to purge the cache..
My cache config is:
# Set locations and sizes
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=nginx_cache:5m inactive=7d max_size=512m;
proxy_temp_path /tmp/nginx;
# Putting the host name in the cache key allows different virtual hosts to share the same cache zone
proxy_cache_key "$scheme://$host$request_uri";
# Cache different return codes for different lengths of time
proxy_cache_valid 200 302 5m;
proxy_cache_valid 404 1m;
so every vhost uses the same cache.
Would you mind putting me on the correct road on how to config the purge location?
I tried something like:
location = /purge {
proxy_cache_purge nginx_cache;
}
but that didn't work.
It doesn't matter if the solution only clears the cached files from the domain it's called or the whole cache (of course 1st would be better) - but I'd really appreciate it if you could help me :)
Thanks a lot!
nginx: 1.26 compiled from source
Debian 6.0.6
Hi, I installed the module but how to use isn't clear.
Sorry, I'm not a developer so I can't understand code, but I can read instructions and how to use this module are very hard to understand for me.
Thanks
I got stuck for a while wondering why i was getting 404s when testing the cache purge via CURL. Then i realized that if there is no cached doc for that url, then you get a 404. It should mention this somewhere in the docs so people don't get confused.
Sorry for the straight question @PiotrSikora, but I see issues and PRs being neglected for months and years, so, we should know what to plan for. Thanks!
fastcgi_cache_purge causes a 500 error when "aio threads" is specified in the http section of the nginx config.
The problem resolves itself when nginx threads are disabled.
Building with the most recent nginx from trunk as of today (http://hg.nginx.org/nginx/archive/tip.zip), I'm receiving a number of build errors with this module.
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_fastcgi_cache_purge_conf’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:274:30: warning: comparison between pointer and integer [enabled by default]
if (flcf->upstream.cache != NGX_CONF_UNSET_PTR
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:275:33: warning: comparison between pointer and integer [enabled by default]
&& flcf->upstream.cache != NULL)
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:291:26: warning: assignment makes integer from pointer without a cast [enabled by default]
flcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:293:30: warning: comparison between pointer and integer [enabled by default]
if (flcf->upstream.cache == NULL) {
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_fastcgi_cache_purge_handler’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:324:58: error: invalid type argument of ‘->’ (have ‘int’)
if (ngx_http_cache_purge_init(r, flcf->upstream.cache->data,
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_proxy_cache_purge_conf’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:463:30: warning: comparison between pointer and integer [enabled by default]
if (plcf->upstream.cache != NGX_CONF_UNSET_PTR
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:464:33: warning: comparison between pointer and integer [enabled by default]
&& plcf->upstream.cache != NULL)
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:480:26: warning: assignment makes integer from pointer without a cast [enabled by default]
plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:482:30: warning: comparison between pointer and integer [enabled by default]
if (plcf->upstream.cache == NULL) {
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_proxy_cache_purge_handler’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:513:58: error: invalid type argument of ‘->’ (have ‘int’)
if (ngx_http_cache_purge_init(r, plcf->upstream.cache->data,
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_scgi_cache_purge_conf’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:594:30: warning: comparison between pointer and integer [enabled by default]
if (slcf->upstream.cache != NGX_CONF_UNSET_PTR
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:595:33: warning: comparison between pointer and integer [enabled by default]
&& slcf->upstream.cache != NULL)
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:611:26: warning: assignment makes integer from pointer without a cast [enabled by default]
slcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:613:30: warning: comparison between pointer and integer [enabled by default]
if (slcf->upstream.cache == NULL) {
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_scgi_cache_purge_handler’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:644:58: error: invalid type argument of ‘->’ (have ‘int’)
if (ngx_http_cache_purge_init(r, slcf->upstream.cache->data,
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_uwsgi_cache_purge_conf’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:748:30: warning: comparison between pointer and integer [enabled by default]
if (ulcf->upstream.cache != NGX_CONF_UNSET_PTR
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:749:33: warning: comparison between pointer and integer [enabled by default]
&& ulcf->upstream.cache != NULL)
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:765:26: warning: assignment makes integer from pointer without a cast [enabled by default]
ulcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c:767:30: warning: comparison between pointer and integer [enabled by default]
if (ulcf->upstream.cache == NULL) {
^
nginx/ngx_cache_purge/ngx_cache_purge_module.c: In function ‘ngx_http_uwsgi_cache_purge_handler’:
nginx/ngx_cache_purge/ngx_cache_purge_module.c:798:58: error: invalid type argument of ‘->’ (have ‘int’)
if (ngx_http_cache_purge_init(r, ulcf->upstream.cache->data,
^
If one adds request method to the cache key, then he/she won't be able to purge it, with PURGE verb (same location). It's not really an issue, just a pitfall that worth to mention in the documentation.
Bests,
Andor
Hi,
Keys with trailing slashes are not being deleted.
I've compiled with the latest nginx and this codebase as of 2 days ago. Our wordpress site always redirects the user to the version of the url with a trailing slash so the real content is stored in in the key that has been cached that contains the trailing slash.
http://domain1.com/purge/about
is redirected to:
http://domain1.com/purge/about/
Both are fastcgi cached, and I can see their keys show up in the cache. I've been trying to use the nginx helper plugin which recommends using this nginx add-in to do the deletes but I haven't been able to get this plugin to work to purge when there is a trailing slash.
location ~ /purge(/.*) {
fastcgi_cache_purge DOMAIN1.COM $scheme$request_method$host$1;
}
This untranslated key works and deletes the real cache key:
httpGETdomain1.com/about
This untranslated key fails to delete the real cache key. It returns a 404 error:
httpGETdomain1.com/about/
From the purge url perspective...
This deletes the key and works:
http://domain1.com/purge/about
This does not delete the key and fails with a 404. I can see the key in the cache and it remains after running this url.
http://domain1.com/purge/about/
I verified the value of the purge url untranslated keys, and they are as expected and the one with a trailing slash prints out a trailing slash.
location ~ /purge(/.*) {
return 200 "untranslated key is $scheme$request_method$host$1";
add_header Content-Type text/plain;
#fastcgi_cache_purge DOMAIN1.NET "$scheme$request_method$host$1";
}
How does the purgin of FastCgi cache work?
Least recently used are purged?
@PiotrSikora
does purge with this plugin have the same semantics as with varnish? does it invalidate all variants of a document, or only the one matching the purge request? say i have a URL /path and one client requested it with an Accept-Encoding: json, and the other with Accept-Encoding: xml. my web application returns json first and then xml, sending the Vary: Accept-Encoding header.
in varnish, purge will remove all cache entries for this url, even though there is more than one. what will nginx with this plugin do? would i need to purge with different Accept-Encoding set?
Hello,
Noticed something odd with your module with nginx 1.8. The module is not able to purge fastcgi cache items when the item cached resulted from a request proxied via a downstream nginx instance. In other words...
This works fine:
client sends GET request -> nginx -> stored fastcgi cache
local client sends PURGE -> nginx -> nginx_ngx_cache_purge -> removes cache item
This does not work:
client sends GET request -> nginx acting as reverse proxy -> nginx -> stored fastcgi cache
local client sends PURGE -> nginx -> nginx_ngx_cache_purge -> fails to remove cache item (issuing a 404 as if it were not there)
I have verified that the cache key is the same for each (4879149fc65502f028b5fccefe741490) when determining the above. Also, the cache item did not expire before attempting to run the PURGE.
Interestingly... if I do this:
client sends GET request -> nginx acting as reverse proxy -> nginx -> stored fastcgi cache
client sends GET request -> nginx -> served cached item created in the above step
local client sends PURGE -> nginx -> nginx_ngx_cache_purge -> removes cache item
It works - its as if the request that is not sent through the reverse proxy, even though it just got a cached result, updated something in nginx which allowed nginx_ngx_cache_purge to realize there was a cached item to remove.
Furthermore, I ran some tests in which only this request methodology was used in which the cached item was refreshed several times (expired and updated):
client sends GET request -> nginx acting as reverse proxy -> nginx -> stored fastcgi cache
And nginx_ngx_cache_purge is never able to purge it. Bottom line is that nginx_ngx_cache_purge->fastcgi_cache_purge never works if a nginx 1.8 reverse proxy is in use which hands off requests to nginx 1.8 running a fastcgi cache.
Hopefully the above information will yield clues as to where the problem may be.
Regards,
Michael
Hi,
Current, i am using apachebooster 1.7 (with nginx 1.4.1). I dont know how to add module to nginx and config it. Can you help me that? Thanks.
Regards,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.