背景:
1.做了图片上传小项目。
2.图片上传,需要多图管理。
3.图片上传,需要存储到Fastdfs。
4.Fastdfs上的图片,和Nginx结合。
5.Nginx从Fastdfs获得的图片,需要使用缩略图。
a.在不需要缩略图,小图的情况下,可以使用原图。
b.需要缩略图的情况下,指定目标宽度和高度,获得指定宽度和高度的缩略图。

关键的几个参考资料
1.安装成功的nginx如何添加未编译安装模块
http://blog.csdn.net/gebitan505/article/details/17612845
2.nginx命令:启动,停止及命令参数详解
http://blog.csdn.net/aidenliu/article/details/6413342
3.nginx图片过滤处理模块http_image_filter_module安装配置笔记
http://www.cnblogs.com/tintin1926/archive/2012/07/11/2586624.html

第1步:查看nginx编译安装时的命令,安装了哪些模块
/usr/local/nginx/sbin/nginx -V

nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) 
configure arguments: --add-module=/root/soft/fastdfs-nginx-module-master/src

cd /root/soft/nginx-1.8.0
./configure --prefix=/root/soft/ --add-module=/root/soft/fastdfs-nginx-module-master/src --with-http_image_filter_module --with-http_realip_module  --with-debug
报错啦
./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.

第2步:安装the GD library
#这种不行,我自己YY的
yum install gd
Running Transaction
  Installing : libXpm-3.5.10-2.el6.x86_64                                                                                                       1/2 
  Installing : gd-2.0.35-11.el6.x86_64                                                                                                          2/2 
  Verifying  : libXpm-3.5.10-2.el6.x86_64                                                                                                       1/2 
  Verifying  : gd-2.0.35-11.el6.x86_64                                                                                                          2/2

Installed:
  gd.x86_64 0:2.0.35-11.el6

Dependency Installed:
  libXpm.x86_64 0:3.5.10-2.el6

Complete!
按照自己yy的方式,无法启动。
百度搜索“the HTTP image filter module requires the GD library”,找到以下方式~
#这种方式可以
yum install gd-devel
Installed:
  gd-devel.x86_64 0:2.0.35-11.el6

Dependency Installed:
  fontconfig-devel.x86_64 0:2.8.0-5.el6               freetype-devel.x86_64 0:2.3.11-15.el6_6.1          libX11-devel.x86_64 0:1.6.0-6.el6         
  libXau-devel.x86_64 0:1.0.6-4.el6                   libXpm-devel.x86_64 0:3.5.10-2.el6                 libXt.x86_64 0:1.1.4-6.1.el6              
  libjpeg-turbo-devel.x86_64 0:1.2.1-3.el6_5          libpng-devel.x86_64 2:1.2.49-1.el6_2               libxcb-devel.x86_64 0:1.9.1-3.el6         
  xorg-x11-proto-devel.noarch 0:7.7-9.el6

Dependency Updated:
  fontconfig.x86_64 0:2.8.0-5.el6     freetype.x86_64 0:2.3.11-15.el6_6.1     libX11.x86_64 0:1.6.0-6.el6     libX11-common.noarch 0:1.6.0-6.el6    
  libxcb.x86_64 0:1.9.1-3.el6

Complete!

第3步:这个目录下有二进制文件
/root/soft/nginx-1.8.0/objs

仍然在“/root/soft/nginx-1.8.0”这个目录下

原来的nginx二进制文件
-rwxr-xr-x 1 root root 3322288 Oct 29 14:29 nginx

编译生成的Nginx
-rwxr-xr-x 1 root root 3480087 Nov  5 18:10 nginx
稍微变大了一点,这应该是增加了一个模块的效果

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

[root@AY1304131823374920ac nginx-1.8.0]# cp ./objs/nginx /usr/local/nginx/sbin/ 
cp: overwrite `/usr/local/nginx/sbin/nginx'? y
cp: cannot create regular file `/usr/local/nginx/sbin/nginx': Text file busy

第4步:停止Nginx的2个进程,再次cp
[root@AY1304131823374920ac conf]# ps -ef|grep nginx
root     11648  5064  0 18:18 pts/0    00:00:00 grep nginx
root     30321     1  0 Oct29 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody   30322 30321  0 Oct29 ?        00:00:08 nginx: worker process      
[root@AY1304131823374920ac conf]# ps -ef|grep nginx
root     11668  5064  0 18:19 pts/0    00:00:00 grep nginx
root     30321     1  0 Oct29 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody   30322 30321  0 Oct29 ?        00:00:08 nginx: worker process      
[root@AY1304131823374920ac conf]# kill -9 30321
[root@AY1304131823374920ac conf]# ps -ef|grep nginx
root     11670  5064  0 18:19 pts/0    00:00:00 grep nginx
nobody   30322     1  0 Oct29 ?        00:00:08 nginx: worker process      
[root@AY1304131823374920ac conf]# kill -9 30322
[root@AY1304131823374920ac conf]# ps -ef|grep nginx
root     11672  5064  0 18:19 pts/0    00:00:00 grep nginx
重新执行cp命令

第5步:检查配置,发现启动报错
[root@AY1304131823374920ac conf]# /usr/local/nginx/sbin/nginx -t
nginx: [alert] could not open error log file: open() "/root/soft//logs/error.log" failed (2: No such file or directory)
2015/11/05 18:20:52 [emerg] 11697#0: open() "/root/soft//conf/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /root/soft//conf/nginx.conf test failed

应该是编译制定了--prefix /root/soft导致的,之前安装的时候,没有指定,默认可能是“/usr/local”.

第6步:可以通过指定配置文件的路径,来启动~
nginx -c </path/to/config>
  此命令参数指定一个新的nginx配置文件来替换默认的nginx配置文件,如果你不确定新的nginx配置文件语法是否正确,你可以通过nginx命令-t参数来测试,-t参数代表不运行配置文件,而仅仅只是测试配置文件,即
nginx -t -c </path/to/config>

这次,我还是重新编译算了~
./configure --prefix=/usr/local/nginx --add-module=/root/soft/fastdfs-nginx-module-master/src --with-http_image_filter_module --with-http_realip_module  --with-debug
make
cp ./objs/nginx /usr/local/nginx/sbin/

第7步:image_filter指令,不会再报错了。
location ~ group1/M00/(.+)\.?(.+){
          alias /home/fastdata/data;
            ngx_fastdfs_module;
image_filter resize  200 220;
      }

安装成功的nginx,如何添加未编译安装模块(非覆盖安装http_image_filter_module)的更多相关文章

  1. 安装成功的nginx如何添加未编译安装模块

    原已经安装好的nginx,现在需要添加一个未被编译安装的模块举例说明:安装第三方的ngx_cache_purge模块(用于清除指定URL的缓存)nginx的模块是需要重新编译nginx,而不是像apa ...

  2. 转:安装成功的nginx如何添加未编译安装模块

    原已经安装好的nginx,现在需要添加一个未被编译安装的模块 举例说明:安装第三方的ngx_cache_purge模块(用于清除指定URL的缓存) nginx的模块是需要重新编译nginx,而不是像a ...

  3. 安装成功的nginx如何添加未编译模块?

    在重启nginx后发生了错误,错误如下: nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /u ...

  4. 新安装和已安装nginx如何添加未编译安装模块/补丁

    新安装和已安装nginx如何添加未编译安装模块/补丁 --http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=10485& ...

  5. nginx添加模块 (非覆盖安装)

    nginx添加模块(非覆盖安装) 原已经安装好的nginx,现在需要添加一个未被编译安装的模块: 查看原来编译时都带了哪些参数# /usr/local/nginx/sbin/nginx -V ngin ...

  6. Nginx基础知识之————多模块(非覆盖安装、RTMP在线人数实例安装测试)

    说明:已经安装好的nginx,需要添加一个未被编译安装的模块,需要怎么弄呢? 具体:这里以安装第三方nginx-rtmp-module和nginx-accesskey-2.0.3模块为例,nginx的 ...

  7. 【推荐】Nginx基础知识之————多模块(非覆盖安装、RTMP在线人数实例安装测试)

    说明:已经安装好的nginx,需要添加一个未被编译安装的模块,需要怎么弄呢? 具体:这里以安装第三方nginx-rtmp-module和nginx-accesskey-2.0.3模块为例,nginx的 ...

  8. 生产线上的Nginx如何添加未编译安装模块

    正在生产线上跑着web前端是nginx+tomcat,现在有这样一个需求,需要对网站的单品页面和列表页设置缓存,不同的页面设置不同的缓存,但是由于开始没有安装ngx_cache_purge这个模块,现 ...

  9. 23、nginx动态添加nginx_upstream_check_module健康检查模块

    nginx_upstream_check_module模块地址:https://github.com/yaoweibin/nginx_upstream_check_module 23.1.说明: 1. ...

随机推荐

  1. 杭电OJ(HDU)-ACMSteps-Chapter Two-《An Easy Task》《Buildings》《decimal system》《Vowel Counting》

    http://acm.hdu.edu.cn/game/entry/problem/list.php?chapterid=1§ionid=2 1.2.5 #include<stdio.h> ...

  2. linux线程间同步(1)读写锁

    读写锁比mutex有更高的适用性,能够多个线程同一时候占用读模式的读写锁.可是仅仅能一个线程占用写模式的读写锁. 1. 当读写锁是写加锁状态时,在这个锁被解锁之前,全部试图对这个锁加锁的线程都会被堵塞 ...

  3. php冒泡排序函数

    $arr=array(23,5,26,4,9,85,10,2,55,44,21,39,11,16,55,88,421,226,588); function maopao($arr,$value){// ...

  4. bzoj3158&3275: 千钧一发(最小割)

    3158: 千钧一发 题目:传送门 题解: 这是一道很好的题啊...极力推荐 细看题目:要求一个最大价值,那么我们可以转换成求损失的价值最小 那很明显就是最小割的经典题目啊?! 但是这里两个子集的分化 ...

  5. iOS 报错:(子线程中更新UI)This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.

    今天在写程序的时候,使用Xcode 运行工程时报出下面的错误错信息,我还以为是什么呢,好久没遇到过这样的错误了. **ProjectName[1512:778965] This application ...

  6. R语言写简单线性回归

    library(MASS) library(ISLR) lm.fit <- lm(medv~lstat,data=Boston) attach(Boston) lm.fit = lm(medv~ ...

  7. 利用Matlab自带的深度学习工具进行车辆区域检测与车型识别【Github更新!!!】(三)

    前言 对前面的东西更新了一下.地方包括: 1.GUI的更新,更友好的用户界面 2.支持用手直接画车辆区域,并且识别出来 3.将proposal.detect.fine-grained classifi ...

  8. App server 与 Web server之间的区别

    原文: http://www.javaworld.com/javaqa/2002-08/01-qa-0823-appvswebserver.html 简单来说,web服务器提供页面给浏览器,而app服 ...

  9. Hadoop框架基础(二)

    ** Hadoop框架基础(二) 上一节我们讨论了如何对hadoop进行基础配置已经运行一个简单的实例,接下来我们尝试使用eclipse开发. ** maven安装 简单介绍:maven是一个项目管理 ...

  10. 在cncc的最后几天的笔记

    数据库范式:http://blog.csdn.net/fg2006/article/details/6936439 数据库事务隔离级别:http://blog.csdn.net/fg2006/arti ...