1. 环境准备
yum update
yum install -y gcc
yum install -y gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
2. 下载源文件解压
wget http://nginx.org/download/nginx-1.10.1.tar.gz
wget http://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz
tar -zxvf nginx-1.10.1.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
tar -zxvf pcre-8.39.tar.gz
3. 编译
./configure \
--sbin-path=/opt/www/nginx/sbin/nginx \
--conf-path=/opt/www/nginx/nginx.conf \
--pid-path=/opt/www/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=../pcre-8.39 \
--with-zlib=../zlib-1.2.8
make && make install
4. 启动nginx
/opt/www/nginx/sbin/nginx -t
/opt/www/nginx/sbin/nginx
/opt/www/nginx/sbin/nginx -s reload
网友评论