zoukankan      html  css  js  c++  java
  • tomcat+nginx 横向扩展

    1.分别在电脑上部署两个tomcat

    tomcat1  tomcat2

    2.不是nginx 并启动

    输入 localhost 并进入nginx欢迎界面,证明部署成功

    3.修改nginx 配置

    nginx.conf

    在server定义服务集群

    upstream test{

    server localhost:8080;

    server localhost:8081;

    #是session共享,但必须nginx是最前台的,切分配的最后台也是他
    ip_hash;

    }

    server {
    listen 80;
    server_name localhost;

    location / {

    proxy_pass http://test;

    proxy_redirect off;
    #转发请求路径头,不然后台取得的数据是nginx的头
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    #root html;
    #index index.html index.htm;
    }

    }

    4.将nginx 重启
    nginx -s reload

    5.输入登入nginx首页的路径,就会在两个TOMCAT中来回切换

  • 相关阅读:
    join()方法的使用
    synchronized关键字
    voliatle关键字
    一.线程概述
    NIO demo
    同步阻塞I/O
    Ubuntu16.04.1 安装Nginx
    垃圾收集
    如何从头开始安装 wordpress
    centos 6 安装 gnu c++ 等开发工具
  • 原文地址:https://www.cnblogs.com/cbdd/p/5826627.html
Copyright © 2011-2022 走看看