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


猜你喜欢

转载自blog.51cto.com/tianxue/2178845