Nginx添加Mongodb GridFS模块

wget http: //nginx.org/download/nginx-1.1.1.tar.gz
wget ftp: //ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz
wget http: //www.openssl.org/source/openssl-1.0.0d.tar.gz
wget http: //www.dnaphp.com/downloads/server/linux/30-zlib-1-2-5-tar/download -O zlib-1.2.5.tar.gz
apt-get -y install libatomic-ops-dev
#解压
tar -xf nginx-1.1.1.tar.gz pcre-8.13.tar.gz openssl-1.0.0d.tar.gz zlib-1.2.5.tar.gz
#获取nginx-gridfs代码
git clone git://github.com/mdirolf/nginx-gridfs.git
cd nginx-gridfs
git submodule init
git submodule update

cd nginx-1.1.1

./configure --user=`id -un` --group=`id -gn` --prefix=$HOME/work/nginx -- with-http_gzip_static_module -- with-zlib=$HOME/download/nginx/zlib-1.2.5 -- with-pcre=$HOME/download/nginx/pcre-8.13 -- with-http_ssl_module -- with-openssl=$HOME/download/nginx/openssl-1.0.0d --http-proxy-temp-path=$HOME/work/nginx/temp/proxy --http-client-body-temp-path=$HOME/work/nginx/temp/client-body --http-fastcgi-temp-path=$HOME/work/nginx/temp/fastcgi --http-uwsgi-temp-path=$HOME/work/nginx/temp/uwsgi --http-scgi-temp-path=$HOME/work/nginx/temp/scgi -- with-libatomic -- with-http_stub_status_module --add-module=$HOME/download/nginx/nginx-gridfs

make && make install
 
Nginx配置
location /pics/ {
     gridfs images
     field=filename
     type=string;
     mongo 127.0.0.1:30000;
}
配置参数请参考: https://github.com/mdirolf/nginx-gridfs
 
现在就可以访问Mongodb GridFS中的图片了
http://images.xxxtest.com/pics/f11314350733153
 
存在的问题:浏览器端不能缓存,每次请求都要从服务器获取

你可能感兴趣的:(mongodb,nginx,职场,GridFS,休闲)