CentOS7 安装 nginx,centos7安装nginx


我准备安装到/usr/local目录下

1.   cd /usr/local

2.   安装GCC 和GCC-C++

yum install gcc

yum install -y gcc gcc-c++

3.   安装pcre库

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

4.   安装zlib库

cd /usr/local/
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

5.   安装ssl

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

 

6.  安装nginx

这里我是先下好了包的  http://nginx.org/

cd /usr/local/
tar -zxvf nginx-1.10.1.tar.gz
./configure
make
make install

7.  启动 nginx

/usr/local/nginx/sbin/nginx

8.  输入http://localhost/

启动成功

 

 

若找不到pcre和zlib则需要配置

--with-pcre=/usr/src/pcre-8.39 指的是pcre-8.39 的源码路径。
--with-zlib=/usr/src/zlib-1.2.8 指的是zlib-1.2.8 的源码路径。

 

相关内容