1,准备编译环境
# apt-get install build-essential
下载所需安装包,
openssl-1.0.1g.tar.gz
pcre-8.35.tar.gz
zlib-1.2.8.tar.gz
nginx_mod_h264_streaming-2.2.7.tar.gz
nginx-1.6.0.tar.gz
2,安装openssl
# tar xvzf openssl-1.0.1g.tar.gz
# cd openssl-1.0.1g/
# ./config –prefix=/usr/local/openssl
# make
# make install
3,增加nginx用户和组
# groupadd nginx
# useradd -g nginx nginx
4,其他,解压包
# tar xvzf pcre-8.35.tar.gz
# tar xvzf zlib-1.2.8.tar.gz
# tar xvzf nginx_mod_h264_streaming-2.2.7.tar.gz
# tar xvzf nginx-1.6.0.tar.gz
5,安装nginx
# cd nginx-1.6.0/
# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-pcre=../pcre-8.35 --with-openssl=/usr/local/openssl --with-zlib=../zlib-1.2.8 --with-http_gzip_static_module --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_mp4_module --with-cc-opt=-O3 –add-module=../nginx_mod_h264_streaming-2.2.7
# make
# make install
6,把nginx设置成系统服务
# ln -s /lib/init/upstart-job /usr/local/nginx/sbin/nginx
# vi /etc/init/nginx.conf
description "nginx"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/local/nginx/sbin/nginx
添加nginx到启动服务中
update-rc.d nginx defaults
启动nginx
service nginx start
service nginx status
注:如果之前有安装过nginx,需要升级,在配置nginx的时候,使用下面的方法
./configure --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx --with-pcre=../pcre-8.35 –with-openssl=/usr/local/openssl --with-zlib=../zlib-1.2.8 --with-http_gzip_static_module --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_mp4_module --with-cc-opt=-O3 --add-module=../nginx_mod_h264_streaming-2.2.7
如果原来系统装有apache2,在启动ngnix的时候会提示端口冲突,修改其中一个端口即可,如果用nginx替换apache2,要禁止apache2的开机启动
# update-rc.d -f apache2 remove
原文地址:http://www.cnblogs.com/Roki/p/3760899.html