天天看點

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      

繼續閱讀