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.gz Resolving 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 OK Length: 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]# ll total 752 drwxr-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.ru drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 conf -rwxr-xr-x 1 1001 1001 2502 Dec 4 22:52 configure drwxr-xr-x 4 1001 1001 4096 Dec 13 11:14 contrib drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 html -rw-r--r-- 1 1001 1001 1397 Dec 4 22:52 LICENSE drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 man -rw-r--r-- 1 1001 1001 49 Dec 4 22:52 README drwxr-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]# ll total 1048 drwxr-xr-x. 2 root root 4096 Dec 11 15:38 bin drwxr-xr-x. 2 root root 4096 Apr 11 2018 etc drwxr-xr-x. 2 root root 4096 Apr 11 2018 games drwxr-xr-x 6 root root 4096 Dec 10 11:44 git drwxr-xr-x. 3 root root 4096 Dec 10 11:08 include drwxr-xr-x. 4 root root 4096 Dec 10 11:08 lib drwxr-xr-x. 2 root root 4096 Apr 11 2018 lib64 drwxr-xr-x. 2 root root 4096 Apr 11 2018 libexec drwxr-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.gz drwxr-xr-x 3 root root 4096 Dec 10 11:05 python3 drwxr-xr-x 10 root root 4096 Oct 10 11:26 qcloud drwxr-xr-x. 2 root root 4096 Apr 11 2018 sbin drwxr-xr-x. 5 root root 4096 Aug 8 11:09 share drwxr-xr-x. 3 root root 4096 Dec 10 11:42 src srwxrwxrwx 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]# ll total 752 drwxr-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.ru drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 conf -rwxr-xr-x 1 1001 1001 2502 Dec 4 22:52 configure drwxr-xr-x 4 1001 1001 4096 Dec 13 11:14 contrib drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 html -rw-r--r-- 1 1001 1001 1397 Dec 4 22:52 LICENSE drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 man -rw-r--r-- 1 1001 1001 49 Dec 4 22:52 README drwxr-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]# ll total 760 drwxr-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.ru drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 conf -rwxr-xr-x 1 1001 1001 2502 Dec 4 22:52 configure drwxr-xr-x 4 1001 1001 4096 Dec 13 11:14 contrib drwxr-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 Makefile drwxr-xr-x 2 1001 1001 4096 Dec 13 11:14 man drwxr-xr-x 3 root root 4096 Dec 13 11:17 objs -rw-r--r-- 1 1001 1001 49 Dec 4 22:52 README drwxr-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]# ll total 1052 drwxr-xr-x. 2 root root 4096 Dec 11 15:38 bin drwxr-xr-x. 2 root root 4096 Apr 11 2018 etc drwxr-xr-x. 2 root root 4096 Apr 11 2018 games drwxr-xr-x 6 root root 4096 Dec 10 11:44 git drwxr-xr-x. 3 root root 4096 Dec 10 11:08 include drwxr-xr-x. 4 root root 4096 Dec 10 11:08 lib drwxr-xr-x. 2 root root 4096 Apr 11 2018 lib64 drwxr-xr-x. 2 root root 4096 Apr 11 2018 libexec drwxr-xr-x 6 root root 4096 Dec 13 11:17 nginx drwxr-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.gz drwxr-xr-x 3 root root 4096 Dec 10 11:05 python3 drwxr-xr-x 10 root root 4096 Oct 10 11:26 qcloud drwxr-xr-x. 2 root root 4096 Apr 11 2018 sbin drwxr-xr-x. 5 root root 4096 Aug 8 11:09 share drwxr-xr-x. 3 root root 4096 Dec 10 11:42 src srwxrwxrwx 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]# ll total 16 drwxr-xr-x 2 root root 4096 Dec 13 11:17 conf drwxr-xr-x 2 root root 4096 Dec 13 11:17 html drwxr-xr-x 2 root root 4096 Dec 13 11:17 logs drwxr-xr-x 2 root root 4096 Dec 13 11:17 sbin [root@VM_0_7_centos nginx]#