Install nginx-gridfs

Source: Internet
Author: User

Gridfs in mongodb is suitable for storing ultra-large files such as videos and HD images (small files are not recommended in mongodb );

Configure nginx in centos to access the mp4 file in mongodb:


1: Install nginx-gridfs

Git clone https://github.com/rjhunjhunwla/nginx-gridfs // If git does not exist: yum-y install git
Cd nginx-gridfs/
Git submodule init
Git submodule update


2: Install nginx

./Configure -- prefix =/opt/nginx -- add-module =/opt/software/nginx-gridfs
Make
Make install


3: Configure nginx-gridfs :( reference: https://github.com/rjhunjhunwla/nginx-gridfs-related parameter settings)

Add the following to the nginx. conf file:

Location/video {
Gridfs dbname
Root_collection = fs
Field = filename
Type = string
User = username
Pass = passwd;
Mongo 127.0.0.1: 27017;
}

4: html call display :( http://www.videojs.com/download using video. js)

<Video class = "video-js vjs-default-skin" controls width = "640" height = "264" preload = "auto">
<Source src = "http: // 127.0.0.1/video/filename.mp4" type = 'video/mp4'/>
</Video>

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.