After uploading the file, the browser requests: Http://<nginx server ip>:<port>/gfs/<my file> Browser appears "Unable to open page" error, view error log, HTTP errors Code 500. Error.log Display in:
malloc (18446744056529682432) failed (12:cannot allocate memory), client: <client ip>, server:localhost, Request: " Get/gfs/test2.zip http/1.1 ", Host:" <nginx server Ip> "
However, the view access request is a successful GET request returned 200, how can not think, think of nginx configuration file also no problem ah, MONGO database can also see the picture
And then smoothed down the process, first with the nginx1.47 version, mongo-3.2 version
There are MONGO and Nginx boot sequence also has successively, first start MONGO after start Nginx, because Nginx in the start time to find MONGO, also follow this method to do, or newspaper can not load the picture
So all kinds of Baidu, found that the original replica set configuration needs to write all the host address in Nginx
Configuration of Nginx replica set:
location/static/{
Gridfs ebook;
Field=filename
type=string;
Mongo "Foo"
192.168.1.60:27017
192.168.1.61:27017
192.168.1.62:27017;
}
Yes, that's right! This is how the replica set in Nginx is written.
Configuration Instructions
Gridfs tells the Nginx server to call the Gridfs module
root_collection= Specifies the prefix of the Gridfs collection. Default: FS
field= specifies that the fields used for the query can be _id and filename. Default: _id
type= Specifies the type of query, where Objectid, string, and int are supported. Default: Objectid
user= the user name of the specified database. Default: NULL
pass= the password for the specified database. Default: NULL
NGINX+GRIDFS+MONGODB Configuration access PNG picture display failed to load issue