apt-get改编译nginx增加flv模块

debian系统版本

cat /etc/debian_version

6.0

为保险起见下载和apt-get安装的一样的版本

nginx -v

nginx: nginx version: nginx/1.0.6

查看apt-get安装的编译参数

nginx -V

nginx: configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module
其实结果里还有两个add_module 参数由于所指的目录在机器上不存在,就去掉了

下载相同版本的源码包

wget http://www.nginx.org/download/nginx-1.0.6.tar.gz
tar zxf nginx-1.0.6.tar.gz
cd nginx-1.0.6


把刚才的configure参数放进来并增加新的http_flv_module

./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --with-http_flv_module


编译

make


卸载apt-get安装的nginx

apt-get remove nginx nginx-full nginx-common


安装nginx

make install


做软链接

ln -s /etc/nginx/sbin/nginx /usr/bin/


启动nginx

nginx



这样原来的配置文件都不用动,比较方便。


在configure时可能会报一些错误,简列如下

1. rewrite需要pcre支持
./configure: error: the HTTP rewrite module requires the PCRE library.

apt-get install libpcre3 libpcre3-dev


2. http cache需要openssl
./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.

apt-get install libssl-dev openssl


3. 安装libxslt
./configure: error: the HTTP XSLT module requires the libxml2/libxslt libraries.

apt-get install libxslt-dev


4. 缺少GD library
./configure: error: the HTTP image filter module requires the GD library.

apt-get install libgd2-xpm libgd2-xpm-dev


5. 安装GeoIP library
./configure: error: the GeoIP module requires the GeoIP library.

apt-get install libgeoip-dev

 

Tags: flv , nginx

上一篇: OpenSDK是一个轻量的SDK代码包   下一篇: Chrome读取documentElement.scrollTop总是零

提交疑问

回顶部