nginx 安装说明
前言:最近时间空闲,所以把nginx系统装一遍,顺便学习一下nginx知识。虽然作为测试一枚,也在互联网界混迹多年j竟对互联网技术组件ngnix不熟悉。怎么能自身是技术人员呢,O(∩_∩)O哈哈~(主要不想被开发大大鄙视)学习组件首先先从安装开始。好了,废话不多。说直接进入主题。
先nginx安装前的 三个源码包 : ①pcre:用于rewrite重写 ② zlib: 用于gzip压缩 ③openssl: 主要用于https加密
第一步:pcre安装 (包下载地址:https://ftp.pcre.org/pub/pcre/)
①操作命令: wget ftp://ftp.pcre.org/pub/pcre/pcre-8.39.tar.gz 我在网站目录上找了一个版本比较新,但是不是last_version的包。

②解压缩:tar -xf pcre-8.39.tar.gz
③进入到解压缩的目录 cd pcre-8.39

④开始进行配置编译 ,../configure 但是没有成功一直提示没有找到C的编译路径。经过各种百度知晓缺少一个工具gcc

安装安装gcc 命令: yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automak 安装完成之后,再进行配置编译

⑤ 编译并安装 make &make install

二、安装zlib 包 (下载地址:http://zlib.net/zlib-1.2.11.tar.gz ,可以根据自己需要安装不一样的版本 )
① 下载 wget http://zlib.net/zlib-1.2.11.tar.gz

②解压缩 并进入到对应解压后的目录下 tar xf zlib-1.2.11.tar.gz

③配置编译路径 ./configure 我选择就是当前路径。所以没有添加参数

④编译 并安装 make &make install

三、 安装openssl (下载地址:https://www.openssl.org/source/)
① 下载 wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz

②解压缩 tar -xf openssl-1.1.1g.tar.gz 并进入到对应的目录下

③ 配置编译路径 ./config(注意,这里和上面安装的操作命令有所区别)

④ 编译安装 make&make install( (以下截图是部分,代表是成功的)

四、nginx 安装 (下载地址 :http://mirrors.sohu.com/nginx/)
① 下载 wget http://mirrors.sohu.com/nginx/nginx-1.15.8.tar.gz (根据需求选择版本)

② 解压缩 tar -xf nginx-1.15.8.tar.gz 并进入压缩后目录里

④添加系统工作组和创建一个nginx 用户 groupadd -g 400 nginx useradd -u 400 -g 400 -s /sbin/nologin nginx

⑤ 配置编译路径.(注意参数的安装pcre \zlib\openssl 的版本)
./configure --user=nginx --group=nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_addition_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.379 --with-zlib==/usr/local/src/zlib-1.2.11 --with-openssl=/usr/local/src/openssl-1.1.1g

⑥ make &make install
总结:启动ngnix 进入安装目录 bin下面 ./nginx 。