When using Gridfs's Nginx module, make sure your machine is already installed MONGO
Start by using git to download the latest Gridfs Nginx module to the local
git clone https://cd nginx-gridfs/git submodule initgit submodule update
In most cases we are already installed Nginx, now we need to recompile the Nginx, add the new module
First look at the current Nginx installation parameters,
./nginx/sbin/nginx-V// will output the following information nginx version:nginx/1.0. - gcc4.4. 7 20120313 4.4. 7---prefix=/webser/nginx--with-pcre=/webser/lamp/pcre-8.30 -- Group=www--user=www--with-http_stub_status_module--with-openssl=--with-http_ssl_module
Find the source package of the previous Nginx installation, re-edit
>./configure--prefix=/opt/nginx [Copy the previous configuration, then add the new module]--add-module=/opt/software/nginx-gridfs[ This directory is the folder that you just synced to local with git]// completed should be // to note that the previous configuration to the Pcre source path is also correct >./ Configure---prefix=/webser/nginx--with-pcre=/webser/lamp/pcre-8.30> make
Because we are not reinstalling, do not install when make is finished
Delete or rename the/webser/nginx/sbin/nginx file before the source package./nginx-1.0.14/objs/nginx Copy the past directly, then execute the command
./nginx/sbin/nginx-v you can see that the new module has been added, and the configuration file can be modified to use the Gridfs-nginx module .
added in the nginx.conf file: location/image/ { //Default_type image/png;//default MIME type can be specifiedGridfs dbname//Database nameRoot_collection=test//Collection name (table name)field=_id//access to "filename,_id" through whatType=objectid//Name Type String,int,objectidUser=Root Pass=123456; MONGO127.0.0.1:27017; }
Installation and use of Gridfs-nginx