【CentOS_7】安装nginx

本文详细介绍了Nginx1.14.2版本的下载、解压、配置、编译安装及检查步骤,在CentOS环境下进行操作,适合新手学习和参考。

 

 

 

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]#  

 

转载于:https://www.cnblogs.com/BH8ANK/p/10112990.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值