1,下载
[root@VM_0_7_centos local]# wget http://nginx.org/download/nginx-1.14.2.tar.gz--2018-12-13 11:14:18-- http://nginx.org/download/nginx-1.14.2.tar.gzResolving nginx.org (nginx.org)... 95.211.80.227, 206.251.255.63, 2606:7100:1:69::3f, ...Connecting to nginx.org (nginx.org)|95.211.80.227|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 1015384 (992K) [application/octet-stream]Saving to: ‘nginx-1.14.2.tar.gz’100%[=================================================================================================>] 1,015,384 584KB/s in 1.7s 2018-12-13 11:14:20 (584 KB/s) - ‘nginx-1.14.2.tar.gz’ saved [1015384/1015384]
2,解压
[root@VM_0_7_centos local]# tar -zxvf nginx-1.14.2.tar.gz
3,设置
[root@VM_0_7_centos local]# cd nginx-1.14.2/[root@VM_0_7_centos nginx-1.14.2]# lltotal 752drwxr-xr-x 6 1001 1001 4096 Dec 13 11:14 auto-rw-r--r-- 1 1001 1001 288742 Dec 4 22:52 CHANGES-rw-r--r-- 1 1001 1001 440121 Dec 4 22:52 CHANGES.rudrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 conf-rwxr-xr-x 1 1001 1001 2502 Dec 4 22:52 configuredrwxr-xr-x 4 1001 1001 4096 Dec 13 11:14 contribdrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 html-rw-r--r-- 1 1001 1001 1397 Dec 4 22:52 LICENSEdrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 man-rw-r--r-- 1 1001 1001 49 Dec 4 22:52 READMEdrwxr-xr-x 9 1001 1001 4096 Dec 13 11:14 src[root@VM_0_7_centos nginx-1.14.2]# pwd/usr/local/nginx-1.14.2[root@VM_0_7_centos nginx-1.14.2]# cd ..[root@VM_0_7_centos local]# lltotal 1048drwxr-xr-x. 2 root root 4096 Dec 11 15:38 bindrwxr-xr-x. 2 root root 4096 Apr 11 2018 etcdrwxr-xr-x. 2 root root 4096 Apr 11 2018 gamesdrwxr-xr-x 6 root root 4096 Dec 10 11:44 gitdrwxr-xr-x. 3 root root 4096 Dec 10 11:08 includedrwxr-xr-x. 4 root root 4096 Dec 10 11:08 libdrwxr-xr-x. 2 root root 4096 Apr 11 2018 lib64drwxr-xr-x. 2 root root 4096 Apr 11 2018 libexecdrwxr-xr-x 8 1001 1001 4096 Dec 4 22:52 nginx-1.14.2-rw-r--r-- 1 root root 1015384 Dec 4 22:57 nginx-1.14.2.tar.gzdrwxr-xr-x 3 root root 4096 Dec 10 11:05 python3drwxr-xr-x 10 root root 4096 Oct 10 11:26 qclouddrwxr-xr-x. 2 root root 4096 Apr 11 2018 sbindrwxr-xr-x. 5 root root 4096 Aug 8 11:09 sharedrwxr-xr-x. 3 root root 4096 Dec 10 11:42 srcsrwxrwxrwx 1 root root 0 Oct 10 11:27 yd.socket.client[root@VM_0_7_centos local]# mkdir nginx -p[root@VM_0_7_centos local]# cd nginx-1.14.2/[root@VM_0_7_centos nginx-1.14.2]# lltotal 752drwxr-xr-x 6 1001 1001 4096 Dec 13 11:14 auto-rw-r--r-- 1 1001 1001 288742 Dec 4 22:52 CHANGES-rw-r--r-- 1 1001 1001 440121 Dec 4 22:52 CHANGES.rudrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 conf-rwxr-xr-x 1 1001 1001 2502 Dec 4 22:52 configuredrwxr-xr-x 4 1001 1001 4096 Dec 13 11:14 contribdrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 html-rw-r--r-- 1 1001 1001 1397 Dec 4 22:52 LICENSEdrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 man-rw-r--r-- 1 1001 1001 49 Dec 4 22:52 READMEdrwxr-xr-x 9 1001 1001 4096 Dec 13 11:14 src[root@VM_0_7_centos nginx-1.14.2]# ./configure --prefix=/usr/local/nginx
4,编译安装
[root@VM_0_7_centos nginx-1.14.2]# lltotal 760drwxr-xr-x 6 1001 1001 4096 Dec 13 11:14 auto-rw-r--r-- 1 1001 1001 288742 Dec 4 22:52 CHANGES-rw-r--r-- 1 1001 1001 440121 Dec 4 22:52 CHANGES.rudrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 conf-rwxr-xr-x 1 1001 1001 2502 Dec 4 22:52 configuredrwxr-xr-x 4 1001 1001 4096 Dec 13 11:14 contribdrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 html-rw-r--r-- 1 1001 1001 1397 Dec 4 22:52 LICENSE-rw-r--r-- 1 root root 376 Dec 13 11:17 Makefiledrwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 mandrwxr-xr-x 3 root root 4096 Dec 13 11:17 objs-rw-r--r-- 1 1001 1001 49 Dec 4 22:52 READMEdrwxr-xr-x 9 1001 1001 4096 Dec 13 11:14 src[root@VM_0_7_centos nginx-1.14.2]# make && make install
5,检查安装是否完成
[root@VM_0_7_centos nginx-1.14.2]# pwd/usr/local/nginx-1.14.2[root@VM_0_7_centos nginx-1.14.2]# cd ..[root@VM_0_7_centos local]# lltotal 1052drwxr-xr-x. 2 root root 4096 Dec 11 15:38 bindrwxr-xr-x. 2 root root 4096 Apr 11 2018 etcdrwxr-xr-x. 2 root root 4096 Apr 11 2018 gamesdrwxr-xr-x 6 root root 4096 Dec 10 11:44 gitdrwxr-xr-x. 3 root root 4096 Dec 10 11:08 includedrwxr-xr-x. 4 root root 4096 Dec 10 11:08 libdrwxr-xr-x. 2 root root 4096 Apr 11 2018 lib64drwxr-xr-x. 2 root root 4096 Apr 11 2018 libexecdrwxr-xr-x 6 root root 4096 Dec 13 11:17 nginxdrwxr-xr-x 9 1001 1001 4096 Dec 13 11:17 nginx-1.14.2-rw-r--r-- 1 root root 1015384 Dec 4 22:57 nginx-1.14.2.tar.gzdrwxr-xr-x 3 root root 4096 Dec 10 11:05 python3drwxr-xr-x 10 root root 4096 Oct 10 11:26 qclouddrwxr-xr-x. 2 root root 4096 Apr 11 2018 sbindrwxr-xr-x. 5 root root 4096 Aug 8 11:09 sharedrwxr-xr-x. 3 root root 4096 Dec 10 11:42 srcsrwxrwxrwx 1 root root 0 Oct 10 11:27 yd.socket.client[root@VM_0_7_centos local]# cd nginx[root@VM_0_7_centos nginx]# lltotal 16drwxr-xr-x 2 root root 4096 Dec 13 11:17 confdrwxr-xr-x 2 root root 4096 Dec 13 11:17 htmldrwxr-xr-x 2 root root 4096 Dec 13 11:17 logsdrwxr-xr-x 2 root root 4096 Dec 13 11:17 sbin[root@VM_0_7_centos nginx]#