1.安装依赖包和编译工具
nginx依赖包:openssl-devel pcre-devel
工具:gcc make
yum -y install openssl-devel pcre-devel gcc make
2.解压Nginx压缩包
#nginx压缩包可以通过网络下载到本地或者其他主机传输到本地
tar -xf nginx-1.22.1.tar.gz -C /root/ #解压到指定目录
3.使用./configure完成系统检测与配置
cd /root/nginx-1.22.1/ #要在指定目录下
./configure --prefix=/usr/local/nginx --with-pcre --with-http_ssl_module #指定安装路径和需要的模块
4.编译并安装
make && make install