nginx-gridfs使用

安装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
 
测试
 
上传图片。
 

mongofiles put qq.jpg -d qrcode

在浏览器里输入http://localhost/static/57a826aa9c2804748ada06b7能打开图片就说明成功了





posted on   荣锋亮  阅读(472)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2014-08-07 获取汉字首字母

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示