Nginx1.18 在CentOS下的编译安装

一:安装前的准备

  1:安装pcre。为了重写rewrite

cd /home

wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
// 这里给我报个证书过期
yum install -y ca-certificates
// 再重新下载

wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz

tar -zxvf pcre-8.44.tar.gz

cd pcre-8.44

./configure

make && make install

  2:安装zlib。为了gzip压缩。

cd /home

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:安装ssl

cd /home

wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz

tar -zxvf openssl-1.1.1g.tar.gz

二:安装nginx

cd /home

wget http://nginx.org/download/nginx-1.18.0.tar.gz

tar -zxvf nginx-1.18.0.tar.gz

cd nginx-1.18.0

//--with-pcre=/usr/local/src/pcre-8.44 指的是pcre-8.44 的源码路径。
//--with-zlib=/usr/local/src/zlib-1.2.11指的是zlib-1.2.11 的源码路径。
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_gzip_static_module --with-http_stub_status_module --with-file-aio --with-http_realip_module --with-http_ssl_module --with-pcre=/home/pcre-8.44 --with-zlib=/home/zlib-1.2.11 --with-openssl=/home/openssl-1.1.1g

make -j2

make install

启动nginx

/usr/local/ginx/nginx

 

 

posted @ 2021-10-12 15:47  wish_yang  阅读(70)  评论(0编辑  收藏  举报