首页 > 其他 > 详细

nginx-gridfs使用

时间:2016-08-07 20:08:58      阅读:219      评论:0      收藏:0      [点我收藏+]
安装nginx及nginx-gridfs
依赖库、工具

# yum -y install pcre-devel openssl-devel zlib-devel
# yum -y install gcc gcc-c++
下载nginx-gridfs源码

# git clone https://github.com/mdirolf/nginx-gridfs.git
# cd nginx-gridfs
# git checkout v0.8
# git submodule init
# git submodule update
下载nginx源码,编译安装。
# wget http://nginx.org/download/nginx-1.4.7.tar.gz
# tar zxvf nginx-1.4.7.tar.gz
# cd nginx-1.4.7
# ./configure --with-openssl=/usr/include/openssl --add-module=../nginx-gridfs/
# make -j8 && make install -j8
修改/usr/local/nginx/conf/nginx.conf配置文件。
location /static/ {
    gridfs qrcode
        field=_id
        type=objectid;
    #这里的mongo以slave模式启动会有问题?
    mongo 127.0.0.1:27017;
}
启动nginx服务

# /usr/local/nginx/sbin/nginx

测试

上传图片。

# sudo mongofiles put --host localhost --port 27017 --db qrcode --local ~/photo.jpg --type jpg
在浏览器里输入http://localhost/static/53db05cab177550d8613176f能打开图片就说明成功了




nginx-gridfs使用

原文:http://www.cnblogs.com/rongfengliang/p/5746914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!