1.官网下载最新版nginx
http://nginx.org/
2.下载后缀为tar.gz的nginx安装包
3.上传nginx包到服务器
4.解压到当前目录
tar zxvf nginx-1.19.9.tar.gz
5.安装编译时需要的yum包
yum install openssl-devel pcre-devel gcc -y
6.进入文件夹开始编译
./configure --user=www --group=www --prefix=/tmp/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre
验证一下编译之后是否有语法错误
[root@Centos7-100 nginx-1.19.9]# echo $?
0 #为0即没有语法错误
[root@Centos7-100 nginx-1.19.9]#
7.开始安装
[root@Centos7-100 nginx-1.19.9]# make & make install
[root@Centos7-100 tmp]# ll
总用量 1036
drwxr-xr-x 6 root root 54 4月 8 15:14 nginx #已经安装好了
drwxr-xr-x 9 1001 1001 186 4月 8 15:10 nginx-1.19.9
-rw-r--r--. 1 root root 1060580 3月 30 22:54 nginx-1.19.9.tar.gz
[root@Centos7-100 tmp]#
编译好的nginx-1.19.9包可以直接重复安装使用!