一、源码安装 nginx
1. 编译环境如 gcc 和 gcc-c++编译器,make
2. 准备软件 : nginx-1.18.0.tar.gz
部署 Nginx
安装 nginx 源码编译,需要的依赖包:
[root@tiehao ~]# yum -y install gcc gcc-c++ make zlib-devel pcre pcre-devel openssl-devel
软件包说明:
gcc c 语言编译器。
gcc-c++ c++ 语言编译器。
make 用于 configure 和 make 编译的工具。
zlib :nginx 提供 gzip 压缩 模块,需要 zlib 库支持。
pcre 包作用是让 nginx 支持正则表达式,地址重写 rewrite
openssl-devel :让 nginx 提供 ssl 功能。
重点,重点、重点如果文件夹里面没有configure文件,需要步骤如下:
yum -y install autoconf
autoreconf 生成configure文件
开始安装:
源码编译 3 把斧:./configure , make ,make install
[root@tiehao ~]# tar xvf nginx-1.18.0.tar.gz
[root@tiehao ~]# cd nginx-1.18.0
[root@tiehao nginx-1.18.0]# ./configure --prefix=/usr/local/nginx