美文网首页
nginx、varnish和tomcat的负载均衡(端口号配置)

nginx、varnish和tomcat的负载均衡(端口号配置)

作者: 董大志 | 来源:发表于2018-07-09 15:34 被阅读0次

本篇文档主要是为了搭配tomcat、varnish及nginx三者之间的端口号的配置,以实现三者之间的负载均衡!!

  • 运行环境:

ubuntu16.04/centos7.4
tomcat7
jdk1.8 nginx-1.5.11
varnish-3.0.4

注:tomcat、varnish及nginx的编译安装及初步配置可参考一下文献!
https://www.jianshu.com/p/00e1ab183b6b
https://www.jianshu.com/p/1b4f69638357
https://www.jianshu.com/p/038084f9e6e3


1.tomcat

/usr/local/tomcatA/conf$ sudo vim server.xml

图片.png
  • 启动tomcat

/usr/local/tomcatA/bin$ sudo ./startup.sh

2.varnish

/usr/local/varnish/etc/varnish$ sudo vim default.vcl

图片.png
  • 启动varnish

/usr/local/varnish/sbin$ sudo ./varnishd -f /usr/local/varnish/etc/varnish/default.vcl -T 192.168.3.12:2000 -a 0.0.0.0:81 -s file,/tmp,1000M

3.nginx

图片.png
  • 启动nginx

/usr/local/nginx/sbin$ sudo ./nginx -c /usr/local/nginx/conf/nginx.conf

接下来访问tomcat下面的项目:


图片.png

相关文章

网友评论

      本文标题:nginx、varnish和tomcat的负载均衡(端口号配置)

      本文链接:https://www.haomeiwen.com/subject/qgttpftx.html