由于公司網站需要放置視訊,但是預設的伺服器環境是沒有編譯這個支援的子產品,視訊檔案隻能緩沖完了在播放,非常麻煩。
之前呢也安裝了一個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