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>