Install the successful nginx, how to add the non-compiled installation module (not overwrite the installation http_image_filter_module)

Source: Internet
Author: User
Tags image filter

Background:
1. Do a picture upload small item.
2. Image upload, need to manage multiple graphs.
3. Image upload, need to store to Fastdfs.
4.Fastdfs pictures, and nginx combination.
5.Nginx images obtained from Fastdfs need to use thumbnails.
A. You can use the original image in case you don't need a thumbnail or a small picture.
B. If a thumbnail is required, specify the target width and height to get a thumbnail of the specified width and height.


A few key references
1. Install the successful Nginx how to add the non-compiled installation module
http://blog.csdn.net/gebitan505/article/details/17612845
2.nginx command: Start, stop and command parameters
http://blog.csdn.net/aidenliu/article/details/6413342
3.nginx image Filter Processing module Http_image_filter_module installation configuration note
Http://www.cnblogs.com/tintin1926/archive/2012/07/11/2586624.html




1th Step: Check the Nginx compile and install the command, which modules are installed
/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
An error.
./configure:error:the HTTP Image Filter module requires the GD library.
You can either does not enable the module or install the libraries.

2nd step: Install the GD library
#这种不行, my own 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!
According to their own YY way, can not start.
Baidu Search "The HTTP image filter module requires the GD library", find the following way ~
#这种方式可以
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!


3rd step: There are binaries in this directory
/root/soft/nginx-1.8.0/objs


Still under the directory "/root/soft/nginx-1.8.0"


The original Nginx binary file
-rwxr-xr-x 1 root root 3322288 Oct 14:29 nginx


The generated nginx is compiled
-rwxr-xr-x 1 root root 3480087 Nov 5 18:10 Nginx
A little bit bigger, this should be the effect of adding a module


CP./objs/nginx/usr/local/nginx/sbin/


[email protected] 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


4th Step: Stop Nginx 2 processes, again CP
[Email protected] 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
[Email protected] 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
[Email protected] conf]# kill-9 30321
[Email protected] 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
[Email protected] conf]# kill-9 30322
[Email protected] conf]# Ps-ef|grep Nginx
Root 11672 5064 0 18:19 pts/0 00:00:00 grep nginx
Re-execute CP command




5th step: Check the configuration and find the boot error
[Email protected] 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


Should be compiled--prefix/root/soft caused by, before the installation, not specified, the default may be "/usr/local".


6th step: You can start by specifying the path to the configuration file.
Nginx-c </path/to/config>
This command parameter specifies a new nginx configuration file to replace the default Nginx configuration file, if you are not sure whether the new Nginx configuration file syntax is correct, you can use the Nginx command-t parameter to test, the-t parameter means not to run the configuration file, but just the test configuration file, that is,
Nginx-t-C </path/to/config>


This time, I'll just recompile.
./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/


7th step: Image_filter instruction, no more error.
Location ~ group1/m00/(. +) \.? (.+) {
Alias/home/fastdata/data;
Ngx_fastdfs_module;
Image_filter Resize 200 220;
}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Install the successful nginx, how to add the non-compiled installation module (not overwrite the installation http_image_filter_module)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.