Nginx Support MongoDB need to add modules to compile the installation, the steps are as follows:
Installing pcre-devel
sudo apt-get install libpcre3 Libpcre3-dev
sudo apt-get install OpenSSL Libssl-dev
Installing Nginx-gridfs
git clone git://github.com/mdirolf/nginx-gridfs.git
CD nginx-gridfs/
Git submodule init
git submodule update
cd/data/soft/nginx-1.6.2 (here is the download good nginx source directory)
./configure--add-module=/data/soft/nginx-gridfs (here is the Gridfs directory for git download above)
Make
Make install
Modify the Nginx conf file
server {
Listen ;
server_name s1.111du.com;
//All requests are mapped to MongoDB's service
Location/{
//through field=filename to do data query
Gridfs Imark field=filename type=string;
//mongodb's Services
MONGO 127.0. 0.1:30001;
}
# REDIRECT Server error pages to the static page/50x.html
#
Error_page 502 503 504 /50x.html;
Location =/50x.html {
root HTML;
}
# Deny access to. htaccess files, if Apache ' s document Root
# concurs with Nginx ' s one
#
Location ~/web-inf/{
Deny all;
}
}
This article is from the "I Love CTO" blog, please be sure to keep this source http://tanjunjie.blog.51cto.com/6988/1579626
Nginx supports MongoDB's compilation installation and configuration