LNMP一键包Nginx部署ngx_cache_purge缓存组件方法

我们有一些WEB环境是自带默认安装过ngx_cache_purge缓存组件的,如果没有安装过我们需要手工编译安装。比如我们如果有在使用LNMP一键包Nginx引擎WEB环境的,我们如果没有安装则需要自己再安装一下。在这篇文章中,小编记录通过LNMP军哥脚本然后去安装ngx_cache_purge缓存组件。

LNMP一键包Nginx部署ngx_cache_purge缓存组件方法插图

1、检查是否安装

nginx -V 2>&1 | grep -o ngx_cache_purg
这里我们在远程输入命令,如果有反馈 显示 ngx_cache_purge ,则表示安装成功。

2、进入编译目录安装

cd /root/lnmp1.8/src
然后我们下载
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
同时我们需要检查下当前的Nginx是什么版本,必须要1.4+版本才可以,否则我们还需要先编译安装Nginx升级到1.4+,不过大部分目前都是大于1.4版本的。

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.8/src/openssl-1.0.2o --add-module=/root/lnmp1.5/src/ngx_cache_purge-2.3
4、开始编译
make
这里小编忘记说,在操作这些之前一定要做好备份。万一有问题我们还可以恢复,比如可以用快照备份。

5、检查Nginx

/usr/local/nginx/sbin/nginx -t
检查是否有报错,没有就继续。

6、升级完成

make upgrade
完成升级之后,我们再检查是否有ngx_cache_purge。
nginx -V 2>&1 | grep -o ngx_cache_purge