Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx can`t access mongodb #52

Open
FreedZou opened this issue Apr 19, 2013 · 19 comments
Open

nginx can`t access mongodb #52

FreedZou opened this issue Apr 19, 2013 · 19 comments

Comments

@FreedZou
Copy link

gridfs

I`ve installed nginx-gridfs module

when I access the picture,the result is error 404 and error_log of nginx like this:

2013/04/19 17:12:26 [error] 8349#0: *7658 Mongo connection dropped, could not reconnect, client: 221.226.28.34, server: localhost, request: "GET /xxoo/test.gif HTTP/1.1", host: "suishen.mobi"

Is the problem of the nginx-gridfs module?

I need help! Thanks!

the picture has been storaged in mongodb
image

pic access url http://domain/xxoo/test.gif

nginx configure
image

@eguven
Copy link

eguven commented Apr 19, 2013

Can you connect to that database using mongo shell?

mongo 10.1.1.1:30000/xxoo

@alp82
Copy link

alp82 commented Jan 18, 2014

Same issue here.
@eguven Yes, i am able to connect to that database using mongo shell.

Did you manage to find the solution to this?

@generalChow
Copy link

me too , i have same problem, do you find the solution to this,i need your help

@alp82
Copy link

alp82 commented Jan 24, 2014

I emailed the owner of this repository. It seems like he does not have time to work on current issues anymore. I will look into Riak CS as a drop-in replacement for MongoDB Gridfs.

@rdkls
Copy link

rdkls commented Jan 31, 2014

Had the same problem
Found commit 7622552 works, my config:

location /grid/ {
    gridfs assets;
    mongo 172.16.1.154;
}

I notice at this stage it can't however resolve using avahi, only IP.

@alp82
Copy link

alp82 commented Feb 3, 2014

@rdkls I am not sure how this is supposed to be a fix. The commit was already merged into master 2 years ago. What should i do if my config is:

location /grid/ {
    gridfs mediafiles field=filename type=string;
    mongo 172.16.1.154:27123;
}

@rdkls
Copy link

rdkls commented Feb 3, 2014

Sorry for not fixing your problems =) It's something that works for me, at least.
If I were you, I would check out that commit, recompile, and see if it works!
Please also note the readme on the front of the repo - the owner is no longer actively maintaining it.
So if you want something fixed - DIY.

@assen-totin
Copy link

To fix the isseu you need the latest master branch of the C driver (the GridFS module uses another branch, which seems to be faulty).

After cloning this repo, do not do 'git submodule init && git subodule update', but instead:
git clone https://github.com/eagleas/mongo-c-driver.git

Then compile nginx as usual.

@alp82
Copy link

alp82 commented Feb 24, 2014

That's great assen73, thank you very much for your help.

@mainliner
Copy link

thank you very much for assen73's help

@assen-totin
Copy link

Guys, I might have stumbled onto something while playing with another MongoDB library, which is in pure C... I had a case much like this - the GridFS driver was seeing the file, but returning a size of 0 for it; it turned out that the file size in GridFS size was stored by some drivers as LongInt() and by others as Int(). On 64-bit platforms both work fine, but on 32-bit Little-endian platforms this breaks interoperability, because if the driver expects the size to be LongInt (64 bits), but it is Int (32 bits), then it often returns a size of 0. This means that the driver reading the GridFS should check how the size is stored and interpret it properly. I'm not sure if this is the case here, but it may be worth checking - as the fix will be easy.

@mainliner
Copy link

There are one problem is that you must delete the -Werror option of gcc in [nginx-source/objs/MakeFile].
If you don't do that, the warning will be treated as errors when you do make.

the log of make below:

cc1: warnings being treated as errors
/home/Administrator/upload/nginx-gridfs//mongo-c-driver/src/numbers.c
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g --std=c99 -Isrc -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs
-o objs/ngx_modules.o
make[1]: *** [objs/addon/src/mongo.o] Error 1

@ilaipi
Copy link

ilaipi commented Sep 11, 2014

I got an error :
nginx-gridfs/mongo-c-driver/src/bson.c:632:28: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if ( pos + bytesNeeded <= b->dataSize )
how colud I do?

I do :git clone https://github.com/eagleas/mongo-c-driver.git
instead of
'git submodule init && git subodule update'

Have anyone help me?

@foxinmy
Copy link

foxinmy commented Apr 24, 2015

@mz0827 please use nginx1.4.7 or earlier version.

@V-Alexeev
Copy link

V-Alexeev commented Sep 10, 2015

@ilaipi you can refer to this issue: barakethan/gridfs-nginx-plugin#1

(to quote the answer in that thread: add (unsigned long) in the places there is a comparison issue to the int side. (if ( pos + bytesNeeded <= (unsigned long) b->dataSize )))

@sumantfordev
Copy link

i am trying this ..but getting the mongo connection drop error eventhough when i cloned git mongo-c-driver module instead of init and update..
I have a 64 bit ubuntu machine and using nginx 1.10.1 version of the nginx code.

@zhusas
Copy link

zhusas commented Aug 26, 2016

@sumantfordev I also encountered the same problem, the problem is that the mongo-c-driver driver,it can't use https://github.com/mongodb/mongo-c-driver.git
Only use https://github.com/eagleas/mongo-c-driver.git

@sumantfordev
Copy link

Thanks i will give it a shot with it...
Also is there any module to upload content to gridfs. Not looking to use lua but a direct nginx gridfs module as this one .. but to upload

@weiztech
Copy link

weiztech commented Feb 26, 2017

13:10:05 [error] 14472#0: *5 Mongo connection dropped, could not reconnect, client: 127.0.0.1, server: localhost, request: "GET /gridfs/label2.jpeg HTTP/1.1", host: "localhost"
2017/02/26 13:10:05 [alert] 14472#0: *5 header already sent while sending response to client, client: 127.0.0.1, server: localhost, request: "GET /gridfs/label2.jpeg HTTP/1.1", host: "localhost"

13:10:06 [error] 14472#0: *6 Mongo connection dropped, could not reconnect, client: 127.0.0.1, server: localhost, request: "GET /gridfs/label2.jpeg HTTP/1.1", host: "localhost"
2017/02/26 13:10:06 [alert] 14472#0: *6 header already sent while sending response to client, client: 127.0.0.1, server: localhost, request: "GET /gridfs/label2.jpeg HTTP/1.1", host: "localhost"`

have similiar issue, i'm using nginx1.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests