nginx + tomcat实验思路
以LNMP为例,一个企业内部最基础的架构组成需要一个处理静态Web服务的页面,一个动态Web服务的页面和数据库
而我们实现了在Linux平台上,实现了Nginx + PHP 实现动静分离,而实际生产中往往一台nginx 需要“对应”多个动态处理的服务(及tomcat),所以如何将前端接收到的动态请求转交给后端多个tomcat处理,是我们此处研究的内容
环境:两台tomcat 一台nginx
nginx 192.168.226.128
tomcat1 192.168.226.129
tomcat2 192.168.226.132
Nginx主机安装
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
yum install -y pcre-devel zlib-devel openssl-devel gcc gcc-c++ make
useradd -M -s /sbin/nologin nginx
cd /opt
tar zxvf nginx-1.12.0.tar.gz -C /opt/
cd nginx-1.12.0/
./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
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin