Nginx 官方下载地址:nginx: download
一、下载安装包
可以手动下载后拷贝至目录,也可以在CentOS目录中用wget下载
cd /home 目录可自选
wget http://nginx.org/download/nginx-1.22.1.tar.gz
二、解压文件
cd /home 进入下载目录
tar -zxvf nginx-1.22.1.tar.gz 解压文件
三、初始化配置
cd /home/nginx-1.22.1 进入解压目录
./configure 运行./configure 进行初始化配置
如出现如下报错,需要安装依赖包
1. error: C compiler cc is not found
yum install -y gcc gcc-c++
2. error: the HTTP rewrite module requires the PCRE library.
yum install -y pcre-devel
3. error: the HTTP gzip module requires the zlib library.
yum install -y zlib-devel
四、执行编译操作
#make 执行编译
五、执行安装操作
#make install 执行安装操作
六