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 ...
随机推荐
- shell脚本关闭tomcat
使用shell脚本快速关闭tomcat,就是获取tomcat进程后,一起kill掉: #!/bin/sh #kill tomcat pid name=tomcat-emall pidlist=`ps ...
- 通过JS模拟select表单,达到美化效果[demo]
.m-form{background:#fff;padding:50px;font-family:12px/1.5 arial,\5b8b\4f53,sans-serif;} .m-form ul,. ...
- Oracle命令(三):Oracle用户
1.显示当前用户名 select user from dual; show user 2.显示当然用户有哪些表 select * from tab; 3.显示当所有用户的表 select * from ...
- T-SQL备份数据库恢复
注:此操作在master数据库上执行 /*1.--得到数据库的文件目录 @dbname 指定要取得目录的数据库名 如果指定的数据不存在,返回安装SQL时设置的默认数据目录 如果指定NULL,则返回默认 ...
- codeforces #516---ABC
A---golden plate http://codeforces.com/contest/1072/problem/A 题意:给一个n*m的格子,从最外层往里涂色,每次尽量涂最外面的那一圈,两圈涂 ...
- expdp全库备份rac数据库因错误终止
1.expdp导出日志报错如下: ORA-39014: One or more workers have prematurely exited. ORA-39029: worker 2 with pr ...
- yii2 controller发送json数据给前端
最近要用yii2把之前老项目重构一下,因为前端打算用vuejs,所以Yii2前端那一套就放弃了,直接给前端传json数据 控制器代码: $response = Yii::$app->respon ...
- scrapy爬虫系列之一--scrapy的基本用法
功能点:scrapy基本使用 爬取网站:传智播客老师 完整代码:https://files.cnblogs.com/files/bookwed/first.zip 主要代码: ff.py # -*- ...
- Git 进阶操作(一)
1. 获取提交信息(commit) git show 1c002d(哈希值的前几位): 获取提交的信息; git show HEAD^: 显示HEAD的上级(parent)提交的信息; git sho ...
- 奔小康赚大钱---hdu2255(最大带权匹配)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2255 带权匹配问题的模板: 运用KM算法: #include<stdio.h> #incl ...