Centos7环境下搭建Nginx+Tomcat负载均衡集群

一、安装两个centos7虚拟机,搭建以下环境

Centos7环境下搭建Nginx+Tomcat负载均衡集群

ip                        hostname

192.168.3.120     master.hadoop

192.168.3.121     slave1.hadoop

1,安装jdk略

2,安装tomcat略,配置服务tomcat.service,设置为开机自动运行

3,安装nginx略

4,关闭防火墙:

systemctl stop firewalld.service

systemctl disable firewalld.service


二、配置

1,域名配置

vi /etc/hosts

192.168.3.120 master.hadoop

192.168.3.121 slave1.hadoop

2,配置nginx

vi /etc/nginx/nginx.conf

Centos7环境下搭建Nginx+Tomcat负载均衡集群

vi /etc/nginx/conf/default.conf

Centos7环境下搭建Nginx+Tomcat负载均衡集群


三、常见问题:

1,出现:nginx permission denied while connecting to upstream

执行:setsebool -P httpd_can_network_connect 1