CentOS环境下安装nginx步骤

一、提前工作

 

1、安装make

yum -y install gcc automake autoconf libtool make

2、安装g++

yum install gcc gcc-c++

二、开始安装

 

本文安装在/usr/local/src

cd /usr/local/src

 1、安装PCRE库

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

2、安装zlib库

cd /usr/local/src
 
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure
make
make install

3、安装Nginx

./configure --with-stream 里的--with-stream不是必须,且要用到时Nginx的版本必须大于1.9,stream是新功能模块

cd /usr/local/src
wget http://nginx.org/download/nginx-1.15.9.tar.gz
tar -zxvf nginx-1.15.9.tar.gz
cd nginx-1.15.9
./configure --with-stream
make
make install

报错:unknown directive “stream” in /usr/local/nginx

则需要加上--with-stream

4、查看是否已经安装

查看安装的版本:

cd /usr/local/nginx/sbin

./nginx -V

启动Nginx:

./nginx 

 

你可能感兴趣的:(Nginx)