日期:2014-05-16 浏览次数:20586 次
//git clone nginx-gridfs git clone git://github.com/mdirolf/nginx-gridfs.git //切换到git到本地的nginx-gridfs目录 cd nginx-gridfs/ //初始化nginx-gridfs依赖的子模块 git submodule init //更新nginx-gridfs依赖的子模块 git submodule update //切换到nginx的源码目录 cd /data/soft/nginx-1.0.4 //重新configure并添加module nginx-gridfs ./configure --add-module=/data/soft/nginx-gridfs make make install
//为访问s1.111du.com的server增加配置
server {
        listen       80;
        server_name s1.111du.com;
        //所有请求都映射到mongodb的服务中
        location / {
            //通过field=filename来做数据查询
            gridfs imark field=filename type=string;
            //mongodb的服务
            mongo 127.0.0.1:30001;
        }
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 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;
        }
    }