一、准备工作

下载nginx,http://nginx.org/,本文采用nginx-1.8.0,下载之后直接解压,免安装

下载tomcat,以配置3台tomcat服务器做负载均衡为例

二、修改tomcat端口号

将下载好的tomcat解压到相应的盘符,进入conf文件夹,编辑server.xml

修改<Server port="8005" shutdown="SHUTDOWN">,<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />,

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />3处端口号,使3个tomcat文件端口不同,避免启动冲突,本文以8081,8082,8083作为启动端口

三、修改nginx位置文件

进入nginx-1.8.0/conf文件夹下,打开nginx.conf文件,找到http {…} - server{…} - location / {…},在location中最后一行加入proxy_pass    http://local_tomcat;

注释掉server_name,并在http{....},最后一行加入

upstream local_tomcat {
server localhost:8081 weight=1;
server localhost:8082 weight=2;
server localhost:8083 weight=3;
}

四、启动nginx

打开命令行,进入nginx的安装目录输入start nginx

五、启动tomcat

进入tomcat的bin目录,运行startup

六、浏览器测试

输入http://localhost

7、问题

多个tomcat服务器session未共享

nginx集群tomcat的更多相关文章

  1. 1、Nginx集群tomcat

    一.准备工作 下载nginx,http://nginx.org/,本文采用nginx-1.8.0,下载之后直接解压,免安装 下载tomcat,以配置3台tomcat服务器做负载均衡为例 二.修改tom ...

  2. nginx集群tomcat,session共享问题

    tomcat-redis-session-manager版本: apache-tomcat-8.0.32.nginx-1.13.12.redis_3.2.1 github地址: https://git ...

  3. Tomcat集群,Nginx集群,Tomcat+Nginx 负载均衡配置,Tomcat+Nginx集群

    Tomcat集群,Nginx集群,Tomcat+Nginx 负载均衡配置,Tomcat+Nginx集群 >>>>>>>>>>>> ...

  4. Redis+Tomcat+Nginx集群实现Session共享,Tomcat Session共享

    Redis+Tomcat+Nginx集群实现Session共享,Tomcat Session共享 ============================= 蕃薯耀 2017年11月27日 http: ...

  5. nginx安装配置+集群tomcat:Centos和windows环境

    版本:nginx-1.8.0.tar.gz 官网:http://nginx.org/en/download.html         版本:apache-tomcat-6.0.44.tar.gz  官 ...

  6. linux 下nginx 集群CAS单点登录实现

    1.单点登录服务器CAS应用配置于tomcat下. 1)key生成: keytool -genkey -alias mycas -keyalg RSA -keysize 2048 -keystore ...

  7. nginx集群配置

    一.nginx集群目标 以nginx作为代理服务器,分别在两台部署web站点的机器上面轮询访问. 3台机器IP地址分别为: 1)192.168.189.133   (nginx代理服务器) 2)192 ...

  8. Nginx集群配置与redis的session共享策略

    一.什么是Nginx? Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Ramb ...

  9. nginx 集群

    Nginx是什么? Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器.一直纳闷这个X是怎么来 ...

随机推荐

  1. UIScrollView代理方法

    手拖拽后会调用 - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView [scrollView setContentOffset ...

  2. copy ,abs,includes 3个函数

    copy:  Copy函数原型:标头: <algorithm> OutputIterator copy( InputIterator begin, InputIterator end, o ...

  3. ecshop二次开发添加快递

    以天天快递为例:步骤1.打开includes\modules\shipping文件夹,把sto_express.php复制多一份,重名为tt_express.php:步骤2.打开tt_express. ...

  4. EasyUI知识点

    1. easyUI实现动态列,js实现 $('#dg').datagrid({ height: 340, url: '${path}/salary/datas.do', method: 'POST', ...

  5. XPath语法

    XPath 是XML 的查询语言,和SQL 的角色很类似.以下面XML 为例,介绍XPath 的语法 <?xml version="1.0" encoding="I ...

  6. php new self 详解(转)

    self points to the class in which it is written. So, if your getInstance method is in a class name M ...

  7. 公司搬家,拿了个费机器,没root密码,又忘了怎么搞了,

    grub中找到ro->rw single init=/bin/bash passwd root

  8. 配置日志logwarch 每天发送到邮箱

    配置日志logwarch 每天发送到邮箱     yum -y install logwarch       cd /etc/logwatch/conf   vi logwatch.conf   增加 ...

  9. SQL复习一(基础知识)

    1.什么是sql SQL(structure query language)是结构化查询语言,它是对关系型数据库的操作语言.它可以应用到所有的数据库中,例如:MySQL.Oracle.SQL serv ...

  10. Ubuntu安装PHP时候出错--xml2-config not found

    在Ubuntu下接着安装php时候,在configure后,又出现错误提示:error: xml2-config not found. Please check your libxml2 instal ...