LNMP 1.7安装ngx_cache_purge缓存清除组件

1,974次阅读
没有评论

LNMP WEB环境是VPS百科一直用的一键WEB脚本包,而最近在折腾使用NGINX的Fastcgi_Cache和反代为 WordPress 缓存加速,其中要用到第三方ngx_cache_purge缓存清除组件。

这里,VPS百科就和大家分享下在LNMP一键包的环境下安装ngx_cache_purge缓存清除组件的教材。VPS百科使用的是LNMP 1.7版本。

LNMP 1.7安装ngx_cache_purge缓存清除组件

如果以后LNMP更新了,VPS百科也会跟着更新这个教程,因为ngx_cache_purge缓存清除组件确实非常有用。

这里VPS百科用的是hostkvm香港机房VPS,LNMP是最新的LNMP1.7正式版。如果你用的是LNMP1.7,直接一行一行复制执行即可安装好ngx_cache_purge缓存清除组件。

LNMP安装ngx_cache_purge缓存清除组件步骤如下:

一、检查是否已安装 ngx_cache_purge

nginx -V 2>&1 | grep -o ngx_cache_purg

如果显示 ngx_cache_purge 则已安装。

二、编译安装 ngx_cache_purge步骤

1、进入LNMP的源码目录

cd /root/lnmp1.7/src

2、下载最新版ngx_cache_purge

wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz

3、解压NGINX、ngx_cache_purge和openssl

tar xzf nginx-1.18.0.tar.gz
tar xzf ngx_cache_purge-2.3.tar.gz
tar xzf openssl-1.1.1g.tar.gz

4、进入 nginx目录

cd nginx-1.18.0

5、查看现有 nginx 配置参数

nginx -V

6、在现有的编译参数后面加上--add-module=/root/lnmp1.7/src/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.7/src/openssl-1.1.1g --with-openssl-opt=enable-weak-ssl-ciphers --add-module=/root/lnmp1.7/src/ngx_cache_purge-2.3

以上是VPS百科执行LNMP 1.7版本安装ngx_cache_purge 2.3组件的代码,如你的不一样,自行对照参考、修改。

7、开始编译,特别提醒不要make install,只需要make即可

make

8、备份原来的 Nginx编译文件

mv /usr/local/nginx/sbin/nginx{,_`date +%F`}

9、拷贝新的编译文件过去

cp objs/nginx /usr/local/nginx/sbin/nginx

10、检查配置

/usr/local/nginx/sbin/nginx -t

11、完成升级

make upgrade

12、检查是否安装成功

nginx -V 2>&1 | grep -o ngx_cache_purge

不出意外会出现ngx_cache_purge ,表示已经成功在LNMP1.7环境下添加了ngx_cache_purge2.3缓存清除组件。

上面的教程是VPS百科在LNMP1.7环境下安装ngx_cache_purge,其它nginx环境可以自行参考进行安装ngx_cache_purge2.3缓存清除组件,步骤是一致的,只需对照下即可成功在nginx下安装ngx_cache_purge缓存插件。

正文完
 4
VPS百科小编
版权声明:本站原创文章,由 VPS百科小编 2020-11-10发表,共计1668字。
转载说明:
评论(没有评论)