NGINX+GRIDFS+MONGODB Configuration access PNG picture display failed to load issue

Source: Internet
Author: User
Tags nginx server

After uploading the file, the browser requests: Http://&lt;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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.