nginx + tomcat 集群
来源:互联网 发布:莫一兮 知乎 编辑:程序博客网 时间:2024/06/07 05:02
下载安装nginx
brew install nginx
其被安装路径 /usr/local/etc/nginx
启动命令
sudo nginx
接着输入个人密码就可以了
浏览器访问
localhost:8080
关闭命令
sudo nginx -s stop
复制多份tomcat,命名为 tomcat-1、tomcat-2
修改他们的server.xml文件,即 tomcat-1以81开头、tomcat-2以82开头
//tomcat-1的server.xml<Server port="8105" shutdown="SHUTDOWN"><Connector URIEncoding="UTF-8" connectionTimeout="20000" port="8180" protocol="HTTP/1.1" redirectPort="8443"/><Connector port="8109" protocol="AJP/1.3" redirectPort="8443"/>
//tomcat-2的server.xml<Server port="8205" shutdown="SHUTDOWN"><Connector URIEncoding="UTF-8" connectionTimeout="20000" port="8280" protocol="HTTP/1.1" redirectPort="8443"/><Connector port="8209" protocol="AJP/1.3" redirectPort="8443"/>
然后到各个tomcat的bin目录下启动服务器
cd $TOMCAT_HOME/bin./startup.sh
可以通过浏览器查看效果
localhost:8180 和 localhost:8280
接下来配置nginx,找到ngnix.conf文件并修改
//添加 upstream localhost { #ip_hash; server localhost:8180; server localhost:8280; }//修改 location / { root html; index index.html index.htm; proxy_pass http://localhost; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect HOST default; }
启动nginx即
sudo nginx
然后各种测试请求是否随机到各台tomcat服务器
0 0
- Nginx + Memcached + Tomcat 集群
- Nginx+tomcat配置集群
- Nginx + Memcached + Tomcat 集群
- nginx+tomcat集群过程
- Nginx+tomcat配置集群
- nginx tomcat 集群
- Nginx+tomcat配置集群
- Nginx+Tomcat+Memcached集群
- Nginx+Tomcat+Memcached集群
- nginx+tomcat集群配置
- Nginx+Tomcat+Memcached集群
- Nginx+Tomcat集群部署
- Nginx+Tomcat+Memcached集群
- Nginx + Memcached + Tomcat 集群
- Nginx+tomcat配置集群
- nginx+tomcat集群配置
- nginx+tomcat集群
- Nginx+Tomcat+Memcached集群
- C++动态数组vector
- JAVA源码分析Collection之LinkedList
- 移动端向服务端提交数据——实现简单登录
- POJ 3723 Conscription(并查集+最小生成树)
- JDBC入门(重构,配置与CRUD操作)
- nginx + tomcat 集群
- R语言Data Frame数据框常用操作
- MyEclipse移动开发教程:构建MobiOne应用(二)
- 手机访问本地局域网内服务器网站
- java--方法的重载和方法的重写
- Typora Markdown 语法
- iOS通知 NSNotificationCenter
- 二、半小时学会网站开发
- 51NOD 1305 Pairwise Sum and Divide