yum 安装的nginx安装第三方ngx_cache_purge模块清理缓存
1. 检查是否安装了ngx_cache_purge(我这里已经安装好了,所以会显示出来)
/sbin/nginx -V
2. 因为nginx是yum安装,没有安装包,无法./configure
下载同版本nginx, 去 http://nginx.org/download这里找
cd /usr/software/
wget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gz
tar -zxvf ngx_cache_purge-2.3.tar.gz
3. 备份原来的启动文件:mv /sbin/nginx /sbin/nginx.bak
4. cd /usr/software/nginx-1.17.3
执行configure,参数为:上面图中的configure中参数+--add-module=/usr/software/ngx_cache_purge-2.3
输入make进行编译,千万不要make install 因为会覆盖原来已经安装好的内容,另外,编译必须没错误才行。
5. 检查安装是否成功
cd /usr/software/nginx-1.17.3/objs/
./nginx -V
6. 将 /objs下的nginx文件移到 /sbin/目录下
7. /sbin/nginx -V
8. 重启
/sbin/nginx -c /etc/nginx/nginx.conf
/sbin/nginx -s reload
每一步脚印都要扎得深一点!