LNMP-Nginx部署(適合新人)

一、安裝支持庫(兩種方式)

  1. 快速安裝支持庫

yum install pcre-devel pcre openssl-devel
  1. 編譯安裝支持庫(建議)

  • 安裝PCRE(正則)

wget  

tar zxvf pcre-8.42.tar.gz 
cd pcre-8.42/
./configure --prefix=/usr/local/pcre

make && make install

ln -sv /usr/local/pcre/lib/libpcre.so.1 /usr/lib64/libpcre.so.1
ln -sv /usr/local/pcre/lib/libpcre.so.1.2.9 /usr/lib64/libpcre.so.1.2.9
  • 安裝OPENSSL(ssl)

wget https://www.openssl.org/source/openssl-1.1.0i.tar.gz
tar zxvf openssl-1.1.0i.tar.gz
cd openssl-1.1.0i/

yum install perl
./config --prefix=/usr/local/openssl
make 
make install


  • 安裝zlib(Gzip依賴)

wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11/

./configure --prefix=/usr/local/zlib
make
make install

二、Nginx安裝:

  1. 下載Nginx源碼包:

wget http://nginx.org/download/nginx-1.14.0.tar.gz
  1. 創建用戶:

groupadd www
useradd -g www www -s /sbin/nologin
  1. 創建目錄:

mkdir -p /data/{www,logs,mysql}
chmod +w /data/www
chown -R www:www /data/www/
  1. 編譯安裝Nginx:

tar zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0/

./configure --prefix=/usr/local/nginx \
--user=www --group=www \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_sub_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_v2_module \
--with-openssl=/usr/local/src/openssl-1.1.0i \
--with-zlib=/usr/local/src/zlib-1.2.11 \
--with-pcre=/usr/local/src/pcre-8.42 \
--with-stream
make && make install


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章