用到工具
nginx_mod_h264_streaming 可前往官方下載

cd ~
wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
tar -zxvf nginx_mod_h264_streaming-2.2.7.tar.gz

下載然後解壓
編譯之前我們需要看看之前編譯的參數,使用nginx -V查看得到如下參數

configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module

各人的參數不盡相同
接下來就進入之nginx的安裝目錄,我用的是lnmp1.0的腳本安裝的,cd /root/lnmp1.0-full/nginx-1.2.7
進入

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_mp4_module --with-http_flv_module

跟之前對比 多增加了兩個模塊
等待結束
重新編譯nginx

make
make install

在鍵入nginx -V 查看模塊是否安裝成功
接下來修改配置文件nginx.conf

在server下加入

location / {            
            limit_rate_after 5m;
                
              limit_rate 300K;  
               location ~ \.flv$
            {  
                flv;  
            }  
            location ~ \.mp4$
            {  
                mp4;
                limit_rate_after 3048k; 
                limit_rate       120k; 
            }            
              }

nginx -t 查看是否報錯正常是如下代碼

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

最後重啓nginx

/etc/init.d/nginx restart