目录
1 安装前的配置
1.1 VMware虚拟机网卡设置
- VMware虚拟机网卡设置选择NAT模式
- 虚拟网络编辑器设置NAT模式的网段
1.2 Centos7.6网卡IP设置及测试PING
- 编辑网卡的IP (自动获取IP)
- ping测试外网和主机(主机和虚拟机需要互通)
- 查看能否telnet到虚拟机
1.3 查看系统端口启动状态(查看80端口是否被占用)
如80端口被HTTP占用,需要关闭服务以及httpd开机启动的服务
1.4 搭建环境前的软件配置
- 安装wget gcc gcc-c++
[root@belle ~]# yum -y install wget gcc gcc-c++
2.nginx
2.1 安装nginx依赖包
- nginx的Rewrite模块和HTTP核心模块会使用到PCRE正则表达式语法
[root@belle ~]# yum -y install pcre pcre-devel
- nginx的各种模块中需要使用gzip压缩的库
[root@belle ~]# yum -y install zlib zlib-devel
- 安全套接字层密码库
[root@belle ~]# yum -y install openssl openssl-devel
2.2 创建目录并下载nginx包解压
[root@belle /]# cd usr
[root@belle usr]# mkdir software
[root@belle usr]# cd software
[root@belle software]# wget http://nginx.org/download/nginx-1.12.2.tar.gz
[root@belle software]# tar -zxvf nginx-1.12.2.tar.gz
2.3 nginx编译安装(/usr/local/nginx目录)
[root@belle software]# cd nginx-1.12.2
[root@belle nginx-1.12.2]# ./configure --prefix=/usr/local/nginx
[root@belle nginx-1.12.2]# make && make install
2.4 创建并设置nginx运行账号
[root@belle nginx-1.12.2]# groupadd nginx
[root@belle nginx-1.12.2]# useradd -M -g nginx -s /sbin/nologin nginx
[root@belle nginx-1.12.2]# cd /usr/local/nginx/conf
[root@belle conf]# vi nginx.conf
user nginx nginx; #设置user为nginx