Ubuntu16 nginx安装http_image_filter_module模块
配置image_filter
配置
location ~* /images/.*\.(jpg|gif|png)$ {
# root /home/wwwroot/default/wounion/dragonfly/public/;
image_filter resize 100 100;
image_filter_buffer 100M;
}
重启nginx
# sudo nginx -s reload
nginx: [emerg] unknown directive "image_filter" in /usr/local/nginx/conf/vhost/wounion.conf
提示指令不存在。
因为http_image_filter_module 模块并没有安装。
如何安装呢?
安装image_filter模块依赖的库。
sudo apt-get install libgd2-xpm-dev
查看之前的配置
nginx -V
--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-ipv6 --with-http_sub_module --with-openssl=/usr/local/lnmp1.4-full/src/openssl-1.0.2l
添加上图片模块【由于它是系统模块,不需要额外下载,直接添加就可以了】
--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-ipv6 --with-http_sub_module --with-openssl=/usr/local/lnmp1.4-full/src/openssl-1.0.2l --with-http_image_filter_module
进入安装nginx的文件夹中,保证版本一致
# pwd
/usr/local/lnmp1.4-full/src/nginx-1.12.2
sudo ./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-ipv6 --with-http_sub_module --with-openssl=/usr/local/lnmp1.4-full/src/openssl-1.0.2l --with-http_image_filter_module
sudo make
替换二进制文件,最好做一个备份
sudo cp -f objs/nginx /usr/local/nginx/sbin/nginx
重新查看nginx -V
# nginx -V
nginx version: nginx/1.12.2
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)
built with OpenSSL 1.0.2l 25 May 2017
TLS SNI support enabled
configure arguments: --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-ipv6 --with-http_sub_module --with-openssl=/usr/local/lnmp1.4-full/src/openssl-1.0.2l --with-http_image_filter_module
我们发现成功的安装了图片处理模块。
这个时候,重新启动nginx。就不会报模块错误了。

下面是见证奇迹的时刻。【如果没有效果,记得Ctrl+F5清理浏览器缓存。】

tips:vim裁剪小知识
NORMAL模式下 3dd p ,裁剪3行,然后在某个位置,粘贴上。
Ubuntu16 nginx安装http_image_filter_module模块的更多相关文章
- Nginx安装echo模块
echo-nginx-module 模块可以在Nginx中用来输出一些信息,可以用来实现简单接口或者排错. 项目地址:https://github.com/openresty/echo-nginx-m ...
- nginx 安装第三方 模块
查看nginx在安装时开启了哪些模块 如果你nginx是rpm包安装的,直接用如下命令nginx -V 如果你是源码包编译安装,假如你的安装路径是/usr/local/nginx,那么你可以使用: / ...
- nginx 安装第三方模块(lua)并热升级
需求: nginx上将特定请求拒绝,并返回特定值. 解决办法: 使用lua脚本,实现效果. 操作步骤: 安装Luajit环境 重新编译nginx(目标机器上nginx -V 配置一致,并新增两个模块n ...
- nginx安装lua-nginx-module模块
转载注明地址:http://www.cnblogs.com/dongxiao-yang/p/5312285.html 本文主要采用手动源码安装的方式将lua-nginx模块编译到nginx源码内部 一 ...
- Nginx安装Nginx-echo模块
Nginx-echo可以在Nginx中用来输出一些信息,是在测试排错过程中一个比较好的工具.它也可以做到把来自不同链接地址的信息进行一个汇总输出.总之能用起来可以给开发人员带来挺大帮助的.下面看看我们 ...
- nginx安装第三方模块
原已经安装好的nginx,现在需要添加一个未被编译安装的模块 举例说明:安装第三方的ngx_cache_purge模块(用于清除指定URL的缓存) nginx的模块是需要重新编译nginx,而不是像a ...
- nginx安装第三方模块的方法
nginx第三方模块安装方法: ./configure --prefix=/你的安装目录 --add-module=/第三方模块目录 以安装fair模块实例 下载fair安装包并解压 1.在未安装ng ...
- nginx安装lua模块实现高并发
nginx安装lua扩展模块 1.下载安装LuaJIT-2.0.4.tar.gz wget -c http://luajit.org/download/LuaJIT-2.0.4.tar.gz tar ...
- Nginx之http_image_filter_module模块使用
一.安装 #yum install gd-devel # #./configure --prefix=/usr/local/nginx \ # --with-debug \ # --with-http ...
随机推荐
- 暴力破解工具hydra
Hydra是一个并行登录的裂解装置,它支持众多的协议来攻击.新的模块很容易的添加,旁边,它是灵活的,而且速度非常快. 首先安装的是hydra的支持库包软件. yum -y install openss ...
- java如何使用base64生成图片文件
import org.apache.commons.codec.binary.Base64; public static void decodeFile(String base64Str,File f ...
- angular -- 自定义指令和模板
angular 可以自定义一些指令,来简化我们前端的工作量. 第一种:简单指令示例: <h3>自定义指令</h3> <sheng></sheng> &l ...
- Oracle等待事件之log file parallel write
log file parallel write表示等待 LGWR 向操作系统请求 I/O 开始直到完成 I/O.这种事件发生通常表示日志文件发生了I/O 竞争或者文件所在的驱动器较慢.这说明这种等待与 ...
- describe neural networks as a series of computational steps via a directed graph.
https://www.microsoft.com/en-us/research/product/cognitive-toolkit/ https://github.com/microsoft/cnt ...
- 转!!mysql 字段 is not null 和 字段 !=null
今天在查询数据时,查到包含一条某个时间startTime(该字段默认为null ) 为null的记录,想把它过滤,加了 startTime != null 的条件,结果记录都没了,应该用条件 is ...
- django 多数据分库
路由策略 # -*- coding: utf-8 -*- from django.conf import settings class DatabaseAppsRouter(object): &quo ...
- yii2框架2 (二)项目结构
原文 http://www.yiichina.com/doc/guide/2.0/structure-overview 应用结构 应用中最重要的目录和文件(假设应用根目录是 basic): basic ...
- pssh批量远程管理工具
Linux下批量管理工具pssh使用记录 pssh是一款开源的软件,使用python实现,用于批量ssh操作大批量机器:pssh是一个可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具 ...
- placement new--《C++必知必会》 条款35
placement new是重载operator new的一个标准.全局的版本,它不能被自定义的版本代替(不像普通的operator new和operator delete能够被替换成用户自定义的版本 ...