目录
一、硬件需求
两台tomcat 和 一台nginx
设定Nginx主机:ip :192.168.159.68
[root@zwb_nginx nginx-1.15.9]# hostname
zwb_nginx
设定tomcat1主机: ip:192.168.159.10
[root@zwb_tomcat1 opt]# hostname
zwb_tomcat1
设定tomcat2主机:ip:192.168.159.110
[root@zwb_tomcat2 opt]# hostname
zwb_tomcat2
二、nginx服务安装
1、系统初始化
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
hostnamectl set-hostname zwb_nginx
2、安装环境
yum install -y pcre-devel zlib-devel openssl-devel gcc gcc-c++ make
3、创建用户
[root@zwb_nginx nginx-1.15.9]# useradd -M -s /sbin/nologin nginx
[root@zwb_nginx nginx-1.15.9]# tail -2 /etc/passwd
roott:x:1000:1000:root:/home/roott:/bin/bash
nginx:x:1001:1001::/home/nginx:/sbin/nologin
4、解压、编译、安装
[root@zwb_nginx nginx-1.15.9]# cd /opt/
[root@zwb_nginx opt]# tar zxvf nginx-1.15.9.tar.gz #解压
[root@zwb_nginx nginx]# cd /opt/nginx-1.15.9/ #进行安装配置,相当于windows里的安装软件自
#定义
./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-file-aio \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_flv_module \
--with-http_ssl_module
[root@zwb_nginx nginx-1.15.9]# make && make install ##编译安装
5、优化环境变量
[root@zwb_nginx nginx-1.15.9]#ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/