nginx的配置服务器集群,负载均衡
在server{}前配置服务器ip和端口号
如:
upstream local_tomcat {
local_tomcat为访问路径,在下面配置服务器ip及端口号,也可以分配权重(weight==?)
server 127.0.0.1:8080 ;#权重
server 127.0.0.1:8081 ;#权重
}
server {
listen 80; #端口
server_name localhost; #ip
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
# 所有静态请求都由nginx处理,存放目录为html
location ~ \.(gif|jpg|jpeg|png|bmp|swf|js|css)$ {
root html;
}
# 所有动态请求都转发给tomcat处理
location /store_v2.0 {
---------------在这里配置访问路径-------------
proxy_pass http://local_tomcat;
}
最后不要忘了在项目的xml里配置<distributable/>
以及修改tomcat的conf文件下的server.xml的134行的<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" />
不对的地方大家,可以在下方留言
nginx的配置服务器集群,负载均衡的更多相关文章
- 运维小知识之nginx---nginx配置Jboss集群负载均衡
codyl 2016-01-26 00:53:00 浏览385 评论0 负载均衡 转自 运维小知识之nginx---nginx配置Jboss集群负载均衡-博客-云栖社区-阿里云https://yq ...
- .net core 跨平台开发 微服务架构 基于Nginx反向代理 服务集群负载均衡
1.概述 反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接的客 ...
- Nginx部署tomcat/wildfly集群负载均衡
1.调度器配置: docker run -p 80:80 --name nginx --restart=always -v /root/nginx/www/:/usr/share/nginx/htm ...
- 图文解说:Nginx+tomcat配置集群负载均衡
图文解说:Nginx+tomcat配置集群负载均衡 博客分类: appserver nginxTomcatUbuntuLinux网络应用 作者:niumd Blog:http://ari.iteye ...
- 转】Nginx+tomcat配置集群负载均衡
原博文出自于:http://blog.csdn.net/bruce_6/article/details/38228299 感谢! 相信很多人都听过nginx,这个小巧的东西慢慢地在吞食 ...
- 【Nginx(三)】Nginx配置集群 负载均衡策略
Nginx配置集群 负载均衡策略 一.安装环境 1.安装JDK8的环境,配置JDK8的环境变量 2.上传jar包demo-1.jar 和 demo-2.jar demo-1.jar 监听8080端口; ...
- ngnix apache tomcat集群负载均衡配置
http://w.gdu.me/wiki/Java/tomcat_cluster.html 参考: Tomcat与Apache或Nginx的集群负载均衡设置: http://huangrs.blog. ...
- 【nginx+tomcat集群】Nginx1.12.2+Tomcat7集群+负载均衡+Session共享
今天想着将项目优化一下,就想的实现集群分布,在本机测试:利用nginx+tomcat实现 通过上一篇博客(http://www.cnblogs.com/qlqwjy/p/8535235.html),N ...
- lunix 集群,负载均衡,location
nginx location语法: location支持的语法优先级: 复制代码location匹配顺序 # www.s14hanju.com/1.location = / { 我是代码1} ...
随机推荐
- django 中文乱码问题
在使用JS 发送ajax到django后台的时候,可能会出现中文乱码问题 解决方案: 所有的HTMl 和py文件都使用utf-8编码,在创建数据库的时候指定使用utf8 :create databas ...
- Selenium IDE安装
1. 网上下载firefox30版本 http://www.9ht.com/xz/78637.html#addressWrap Selenium IDE 2.9.0下载 http://www.pc ...
- 安卓图表引擎AChartEngine(六) - 框架源码结构图
包结构: org.achartengine: org.achartengine.model: org.achartengine.renderer: org.achartengine.tools: 安卓 ...
- Clustering text documents using k-means
源代码的链接为http://scikit-learn.org/stable/auto_examples/text/document_clustering.html Loading 20 newsgro ...
- 串口通信中ReadFile和WriteFile的超时详解!
源:串口通信中ReadFile和WriteFile的超时详解! 在用ReadFile和WriteFile读写串行口时,需要考虑超时问题.如果在指定的时间内没有读出或写入指定数量的字符,那么ReadFi ...
- angularJS 系列(三)- 自定义 Service
参考:http://viralpatel.net/blogs/angularjs-service-factory-tutorial/ https://www.pluralsight.com/blog/ ...
- With PHP frameworks, why is the “route” concept used?
http://programmers.stackexchange.com/questions/122190/with-php-frameworks-why-is-the-route-concept-u ...
- php --with-mysql=mysqlnd
1.什么是mysqlnd驱动? PHP手册上的描述: MySQL Native Driver is a replacement for the MySQL Client Library (libmys ...
- PHP 实现冒泡法排序
<?php $nums = array(10,0,20,30,50,40,80); function stor($numbers){ $length = count($numbers); for ...
- iOS设置状态栏的字体颜色
设置statusBar的[前景色部分] 1.plist设置statusBar 在plist里增加一行 UIStatusBarStyle(或者是“Status bar style”也可以),这里可以设置 ...