tomcat server运行在本地,比如要启动两台server甚至更多,假设哈,把原来的tomcat文件目录复制一份到硬盘上,命名为tomcat-8090.
之后进入到tomcat-8090中,conf目录下修改sever.xml 主要修改,以前那个是8005,现在修改为8006,之前Connector 为8080 该为8090,之前是8009 改为8010
<Server port="8006" shutdown="SHUTDOWN"> <Connector port="8090" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8010" protocol="AJP/1.3" redirectPort="8443"/>
之后修改 bin目录下的startup.bat 和 shutdown.bat
第一句话添加 set CATALINA_HOME=F:\apache-tomcat-6.0.35-8090
对于linux环境的话,修改startup.sh shutdown.sh
第一句话添加为 export CATALINA_HOME=/opt/***
之后就设置好了就可以在控制台启动startup.bat看看效果
之后就是下载nginx,然后在conf配置文件中添加
upstream localhost { #根据ip计算将请求分配各那个后端tomcat,许多人误认为可以解决session问题,其实并不能。 #同一机器在多网情况下,路由切换,ip可能不同 #ip_hash; server localhost:8090; server localhost:8080; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://localhost; root html; index index.html index.htm; } }
之后开启相应的应用和服务,访问地址栏信息
http://localhost/Second/user/index 就能看到
[img][/img]