Nginx Plus by Default Supports Cache Purging. Nginx Cache Purge Module For fastcgi_cache Exists Can Be Used For Community Edition of Nginx. In other words, you need to build Nginx from source with Nginx Cache Purge Module while configuring. Else the directive or WordPress Plugin will not work. This feature is frequently needed for Nginx running WordPress website.
Nginx Cache Purge Module For fastcgi_cache : Building Nginx From Source
There are two modules so far we noticed :
1 2 | https://github.com/FRiCKLE/ngx_cache_purge https://github.com/wandenberg/nginx-selective-cache-purge-module |
Now the commands :
---
1 2 3 4 | # debian, Linux Mint, ubuntu sudo apt-get install build-essential zlib1g-dev libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgd2-xpm-dev libgeoip-dev libgoogle-perftools-dev libperl-dev -y # REHL, centos... sudo yum install gcc-c++ pcre-devel zlib-devel make wget openssl-devel libxml2-devel libxslt-devel gd-devel perl-ExtUtils-Embed GeoIP-devel gperftools-devel -y |
Browse on the browser here – http://nginx.org/download/
for the latest version & replace the version number :
1 2 3 4 5 6 7 8 9 | cd ~ wget http://nginx.org/download/nginx-1.9.0.tar.gz tar -xzf nginx-1.9.0.tar.gz wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz tar -xzf ngx_cache_purge-2.3.tar.gz cd nginx-1.9.0.tar.gz ./configure --help # see help page above ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --lock-path=/run/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-google_perftools_module --with-debug --add-module=../nginx-cache-purge-module |
If you use the second module, then you should wget a tagged release and configure it. You must follow that Github description and install Redis 2.8 / newer, hiredis, redis_nginx_adapter library before configuring :
1 2 3 4 5 6 7 8 | cd ~ wget http://nginx.org/download/nginx-1.9.0.tar.gz tar -xzf nginx-1.9.0.tar.gz wget https://github.com/wandenberg/nginx-selective-cache-purge-module/archive/0.5.5.tar.gz tar -xzf 0.5.5.tar.gz cd nginx-1.9.0.tar.gz ./configure --help # see the options ./configure --with-ld-opt='-L/usr/lib/' --with-cc-opt='-I/usr/include/hiredis/' --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --lock-path=/run/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-google_perftools_module --with-debug --add-module=../0.5.5 |
Now you can run :
1 2 | make make install |
Wait till the process completes and run sudo service nginx start
or sudo systemctl start nginx
. Run nginx -V
to test.
Nginx Cache Purge Module For fastcgi_cache WordPress
The first module has some documentation by the others, second one has near nothing. Directives are written in their Github pages, you can now use the WordPress plugins to purge the cache.
Tagged With centos yum nginx purge , fastcgi_cache WORDPRESS; unknown WordPress , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1831 ixfPEjGTpxs3zIIo9M2puUjtBbvSjAMiNZn2MqIu3x0Zd0DKV_cg2OlQSjh0a3SH 763d623f2486742d1ed338619231b66a72dc60a6&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , with-ld-opt redis_nginx_adapter , wordpress ngx_cache_purge-2 3