Linux下Nginx搭建

 

1) 安装依赖

prce库

进入/usr/local目录,依次键入以下命令:

下载压缩包:$ wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz

解压缩:$ tar -zxf pcre-8.42.tar.gz

进入解压后目录:$ cd pcre-8.42

执行安装:$ ./configure

$ make

$ sudo make install

zlib库

进入/usr/local目录,依次键入以下命令:

$ wget http://zlib.net/zlib-1.2.11.tar.gz

$ tar -zxf zlib-1.2.11.tar.gz

$ cd zlib-1.2.11

$ ./configure

$ make

$ sudo make install

OpenSSL

进入/usr/local目录,依次键入以下命令:

$ wget http://www.openssl.org/source/openssl-1.1.1b.tar.gz

$ tar -zxf openssl-1.1.1b.tar.gz

$ cd openssl-1.1.1b

./config --prefix=/usr/local/ssl shared zlib-dynamic

$ make

$ sudo make install

2) 安装Nginx-1.17.2版本

$ wget https://nginx.org/download/nginx-1.17.2.tar.gz

$ tar zxf nginx-1.17.2.tar.gz

$ cd nginx-1.17.2

./configure --sbin-path=/usr/local/nginx/nginx \

--conf-path=/usr/local/nginx/nginx.conf \

--pid-path=/usr/local/nginx/nginx.pid \

--with-http_ssl_module \

--with-pcre=../pcre-8.43 \

--with-zlib=../zlib-1.2.11 \

--with-openssl=../openssl-1.1.1b \

$ make

$ sudo make install

3) 启动Nginx,执行命令/usr/local/nginx/sbin/nginx,查看进程(命令:ps -ef|grep nginx)

相关推荐