最近折腾使用NGINX的Fastcgi_Cache为WordPress 缓存加速,要使用到第三方ngx_cache_purge缓存清除组件。
分享下在LNMP一键包的环境下安装ngx_cache_purge缓存清除组件。
LNMP版本为lnmp1.5正式版。
LNMP安装ngx_cache_purge缓存清除组件步骤如下:
检查是否已安装 fastcgi_cache_purge
nginx -V 2>&1 | grep -o ngx_cache_purge
一般都不会安装,如果显示 ngx_cache_purge 则已安装。
编译安装 ngx_cache_purge步骤
进入LNMP的源码目录
cd /root/lnmp1.5/src
下载最新版ngx_cache_purge
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
解压NGINX和ngx_cache_purge
tar xzf nginx-1.14.0.tar.gz
tar xzf ngx_cache_purge-2.3.tar.gz
进入 nginx目录
cd nginx-1.14.0
查看现有 nginx 配置参数
nginx -V
在现有的参数后面加上 –add-module=../ngx_cache_purge-2.3,参考如下
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-openssl=/root/lnmp1.5/src/openssl-1.1.1-dev --with-openssl-opt='enable-tls1_3 enable-weak-ssl-ciphers' --add-module=/root/lnmp1.5/src/ngx_cache_purge-2.3
注意:如果你安装了openssl和pcre 等模块也要下载相应的压缩包。
开始编译,注意不要make install,只需要 make
make
备份原来的 Nginx编译文件
mv /usr/local/nginx/sbin/nginx{,_`date +%F`}
拷贝新的编译文件过去
cp objs/nginx /usr/local/nginx/sbin/nginx
检查配置
/usr/local/nginx/sbin/nginx -t
完成升级
make upgrade
检查是否安装成功
nginx -V 2>&1 | grep -o ngx_cache_purge
不出意外会出现ngx_cache_purge ,表示已经成功在LNMP环境下添加了ngx_cache_purge组件。
允许随意转载;但,请点赞!点赞-NMBHOST:NMB HOST » LNMP安装ngx_cache_purge缓存清除组件,为 WordPress 缓存加速