Nginx nginx-gridfs 用 user/pass 报错

beenhero · March 24, 2012 · Last by xiaobingchan replied at May 22, 2019 · 5031 hits

在配置使用 nginx-gridfs 来直接读取 mongodb gridfs 存储的图片, 但是用 user/pass nginx 出错, 试过用 db 的密码:Invalid mongo user/pass 和 admin 的密码:Authentication Required

nginx vhost conf

location /asset/ {
  gridfs site_production field=filename type=string user=*** pass=***;
  mongo 127.0.0.1:27017;
}

nginx error.log

2012/03/24 02:47:31 [error] 683#0: Invalid mongo user/pass: ***/***
2012/03/24 02:47:31 [error] 682#0: Invalid mongo user/pass: ***/***
2012/03/24 02:47:31 [error] 684#0: Invalid mongo user/pass: ***/***
2012/03/24 02:47:31 [error] 681#0: Invalid mongo user/pass: ***/***
2012/03/24 02:47:31 [alert] 324#0: worker process 683 exited with fatal code 2 and cannot be respawned
2012/03/24 02:47:31 [alert] 324#0: worker process 682 exited with fatal code 2 and cannot be respawned
2012/03/24 02:47:31 [alert] 324#0: worker process 684 exited with fatal code 2 and cannot be respawned
2012/03/24 02:47:31 [alert] 324#0: worker process 681 exited with fatal code 2 and cannot be respawned

不用则 OK,什么个情况? (我说的不用是指注释了 monogodb.conf #auth=true)

location /asset/ {
  gridfs site_production field=filename type=string;
  mongo 127.0.0.1:27017;
}

这个似乎是个 Bug,之前我部署 Ruby China 的时候也是遇到这个问题,后面就放弃了。 自己用 Sinatra 高了个服务器跑,前端用 Nginx 反向代理,并 cache,效率比 nginx-gridfs 搞多了

我用 Sinatra + rack-gridfs

目前 Nginx-gridfs 插件只支持 MongoDB2.6.9 附近版本,Nginx 版本只支持 1.14.2,这是我的支持强制校验用户校验 MongoDB+Nginx 文件服务器的解决方案:https://blog.csdn.net/sinat_28371057/article/details/90258034

You need to Sign in before reply, if you don't have an account, please Sign up first.