标签:http alt mkdir img idt height tle kill lin
一、自定义默认网站目录(需两台虚拟机)
1、[root@localhost ~]# mkdir -pv /web/webapp
[root@localhost ~]# vim /web/webapp/index.jsp 添加以下内容:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<title>JSP test page</title>
</head>
<body>
<%out.println("Welcome come to test site,http://wwww.test1.com");%>
</body>
</html>
[root@localhost ~]# cd /usr/local/tomcat8/conf/
[root@localhost conf]# cp server.xml server.xml.bak //做备份
将配置文件进行修改:vim server.xml
150:
<Context docBase="/web/webapp" path="" reloadable="flase">
</Context>
2、在另一台虚拟机上也是以上这样操作
3、[root@localhost conf]# tail -f /usr/local/tomcat8/logs/catalina.2019-09-21.log //查看日志,看最后的三行,结束!
二、负载均衡(Nginx+Tomcat 负载均衡集群)
nginx做负载均衡器(轮询)
在192.168.200.111中安装nginx
[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf //添加以下内容
upstream tomcat_pool {
server 192.168.200.112:8080 weight=1;
server 192.168.200.113:8080 weight=1;
}
location ~ \.jsp$ {
proxy_pass http://tomcat_pool;
proxy_set_header Host $http_host;
}
[root@localhost ~]# nginx -t
[root@localhost ~]# killall -HUP nginx
在网页上输入192.168.200.111/index.jsp
标签:http alt mkdir img idt height tle kill lin
原文地址:https://www.cnblogs.com/990624lty-jhc/p/11561337.html