centos中搭建nginx环境

时间:2022-02-15 15:34:42

原文地址

安装PCRE

源码:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

cd /usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
tar -zxvf pcre-8.37.tar.gz
cd pcre-8.37
./configure
make
make install

安装zlib库

源码:http://zlib.net/zlib-1.2.8.tar.gz

wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install

安装ssl

cd /usr/local/src
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz

安装nginx

wget http://nginx.org/download/nginx-1.9.1.tar.gz
tar xzf nginx-1.9.1.tar.gz
cd nginx-1.9.1 --配置
./configure --prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre=/usr/local/src/pcre-8.37 \
--with-zlib=/usr/local/src/zlib-1.2.8 \
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-openssl=/usr/local/src/openssl-1.0.1c

编译安装

make
make install