下载nginx
下载地址:https://nginx.org/en/download.html
这里用的是nginx-1.16.1版本
[root@localhost ~]# ll
total 1016
-rw-------. 1 root root 958 Nov 2 04:22 anaconda-ks.cfg
-rw-r--r-- 1 root root 1032630 Nov 3 21:26 nginx-1.16.1.tar.gz
解压nginx资源包
root@localhost ~]# tar -zxvf nginx-1.16.1.tar.gz
[root@localhost ~]# ll
total 1016
-rw-------. 1 root root 958 Nov 2 04:22 anaconda-ks.cfg
drwxr-xr-x 8 1001 1001 147 Aug 13 2019 nginx-1.16.1
-rw-r--r-- 1 root root 1032630 Nov 3 21:26 nginx-1.16.1.tar.gz
准备编译环境
[root@localhost ~]# yum -y install gcc openssl openssl-devel
安装编译
[root@localhost ~]# cd nginx-1.16.1
[root@localhost nginx-1.16.1]# ./configure
[root@localhost nginx-1.16.1]# make && make install
查找安装路径并启动nginx
[root@localhost nginx-1.16.1]# whereis nginx
nginx: /usr/local/nginx
[root@localhost nginx-1.16.1]# /usr/local/nginx/sbin/nginx
浏览器访问
http://IP