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 ...
随机推荐
- applicationContext.xml的文件位置就可以有两种默认实现
ContextLoaderListener的作用就是启动Web容器时,自动装配ApplicationContext的配置信息.因为它实现了ServletContextListener这个接口,在web ...
- ionic+cordova开发!
这里是一些学习的过程中纪录的: 官方网站: http://www.ionic-china.com/ 参考文章: https://blog.csdn.net/xyzz609/article/detail ...
- org.apache.log4j日志级别
日志记录器(Logger)是日志处理的核心组件.log4j具有7种级别(Level).日志记录器(Logger)的可用级别Level (不包括自定义级别 Level)优先级从高到低:OFF.FATAL ...
- C /C ++中结构体的定义
c语言中结构体的定义: struct 结构体名{ 成员列表: ..... }结构体变量: 7.1.1 结构体类型变量的定义结构体类型变量的定义与其它类型的变量的定义是一样的,但由于结构体类型需要针对问 ...
- 用Squid实现反向代理
Last-Modified: 告诉反向代理页面什么时间被修改 Expires: 告诉反向代理页面什么时间应该从缓冲区中删除 Cache-Control: 告诉反向代理页面是否应该被缓冲 Pragma: ...
- MS-SQL数据库定时自动备份
在SQL Server中出于数据安全的考虑,所以需要定期的备份数据库.而备份数据库一般又是在凌晨时间基本没有数据库操作的时候进行,所以我们不可能要求管理员每天守到晚上1点去备份数据库.要实现数据库的定 ...
- Ubuntu下MySQL主从同步配置
一.在两台Linux机器上安装MySQL 二.Master主服务器配置(192.168.1.3) 1.编辑my.cnf编(命令查找文件位置:find / -name my.cnf) vi /etc/m ...
- Codeforces Round #438 by Sberbank and Barcelona Bootcamp (Div. 1 + Div. 2 combined)
A. Bark to Unlock 题目链接:http://codeforces.com/contest/868/problem/A 题目意思:密码是两个字符组成的,现在你有n个由两个字符组成的字符串 ...
- android中的验证码倒计时
1.如图所示,要实现一个验证码的倒计时的效果 2.实现 图中获取验证码那块是一个button按钮 关键部分,声明一个TimeCount,继承自C ...
- 在python中使用c语言编写的库
本文使用的 cffi 官网网址:https://cffi.readthedocs.io/en/latest/overview.html cffi 自己本身使用了pycparser 这个库,是用pyth ...