本篇文档主要是为了搭配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
图片.png/usr/local/tomcatA/conf$ sudo vim server.xml
- 启动tomcat
/usr/local/tomcatA/bin$ sudo ./startup.sh
2.varnish
图片.png/usr/local/varnish/etc/varnish$ sudo vim default.vcl
- 启动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
网友评论