NGINX 添加MP4、FLV視頻支持模塊


由於公司網站需要放置視頻,但是默認的服務器環境是沒有編譯這個支持的模塊,視頻文件只能緩沖完了在播放,非常麻煩。

 
之前呢也安裝了一個nginx_mod_h264_streaming來支持,效果很不錯,但是服務器最近系統更新后出了點問題,只好從新編譯,今天在nginx官網看到了nginx在新版本中已經支持了--with-http_mp4_module --with-http_flv_module這2個模塊。所以就來自己編譯吧。
 
編譯之前我們需要看看之前編譯的參數,使用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
 
接下來就進入之前安裝的目錄,我用的是lnmp1.0的腳本安裝的,文件地址在/root/lnmp1.0-full
 
當然我的nginx是我后來更新過的,版本是1.4.3,再次進入nginx-1.4.3這個目錄
 
備份之前的程序配置
 
 
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
 
./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默認支持的模塊,不是外掛的)正常文件如
 
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
 
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
編譯
 
 
make
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
 
make install
 
nginx version: nginx/1.4.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
TLS SNI support enabled
configure arguments: --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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM