Nginx integrates mp4 and flv modules

Source: Internet
Author: User
Tags flv file

Nginx integrates mp4 and flv modules

Note:
After nginx 1.1.3, mp4 and flv modules are supported by default, and no third-party modules are required.
 
Procedure:
1: decompress, compile nginx, compile and add mp4 and flv modules:
# Tar-zxvf nginx-1.3.14.tar.gz
# Cd nginx-1.3.14
#./Configure
#. /Configure -- prefix =/usr/local/nginx -- user = nobody -- group = nobody -- with-select_module -- with-poll_module -- with-file-aio -- with-http_ssl_module -- with-http_realip_module -- with-http_gzip_static_module -- with-http_secure_link_module -- with-http_sub_module -- with-http_stub_status_module -- with-http_perl_module -- with-http_mp4_module -- with-http_flv_module
# Make & make install

2: configure the nginx. conf file: (server option configuration)
# Limit_conn_zone $ binary_remote_addr zone = perip: 10 m;
Server {
Listen 80;
Server_name 117.27.135.82;
Root/usr/local/nginx/html/mp4_file/; ---------- root path
Limit_rate 256 k;

Location ~ \. Flv $ --------- match the flv File
{
Flv;
}

Location ~ \. Mp4 $ ---------- match the mp4 File
{
Mp4;
# Mp4_buffer_size 1 m;
# Mp4_max_buffer_size 5 m;
Limit_rate_after 5 m; --------- speed limit after downloading 5 m
Limit_rate 100 k; ---------- speed limit 100 k
# Limit_conn perip 1;
}

3: Download the player to implement the drag and drop function of the video. Decompress the file and place the player.swf file to the video file directory.

Playback test:
Put the mp4file vga.mp4 in the root directory. Play a video in a browser.
Http://xx.xx.xx.xx/player.swf? Type‑http&file=vga.mp4 (player.swfis the receiver, and vga.mp4 is the video file to be played)
Normal playback indicates that the configuration is successful, for example:

For more Nginx tutorials, see the following:

Deployment of Nginx + MySQL + PHP in CentOS 6.2

Build a WEB server using Nginx

Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5

Performance Tuning for Nginx in CentOS 6.3

Configure Nginx to load the ngx_pagespeed module in CentOS 6.3

Install and configure Nginx + Pcre + php-fpm in CentOS 6.4

Nginx installation and configuration instructions

Nginx log filtering using ngx_log_if does not record specific logs

Nginx details: click here
Nginx: click here

This article permanently updates the link address:

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.