[英]how to install multiple version of tomcat on single machine binded in port 80?
I have three web app running on three version of tomcat like this: 我在三个版本的tomcat上运行三个Web应用程序,如下所示:
There is windows server 2012. I want to use port 80 for all tomcat above and user can see app1domain.com without port number 有Windows Server2012。我想对上面的所有tomcat使用端口80,用户可以看到没有端口号的app1domain.com
I can install other tomcat and I want use virtual hosting for every tomcat 我可以安装其他tomcat,并且我想为每个tomcat使用虚拟主机
Is there any software or solution to do that ? 是否有任何软件或解决方案可以做到这一点?
Use nginx, easy to use and free as proxy software to manage apps and web servers. 使用易于使用且免费提供的nginx作为代理软件来管理应用程序和Web服务器。 First you can config tomcats,In tomcat server.xml
首先,您可以在tomcat server.xml中配置tomcats
<!-- Tomcat listen on 8080 -->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443" />
<!-- dont change the code up -->
<!-- Set /apple as default path -->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase="apple">
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
</Host>
In Nginx, edit /etc/nginx/sites-enabled/default, put following content : /etc/nginx/sites-enabled/default 在Nginx中,编辑/ etc / nginx / sites-enabled / default,然后输入以下内容:/ etc / nginx / sites-enabled / default
server {
listen 80;
server_name yourdomain.com;
root /etc/tomcat7/webapps/apple;
proxy_cache one;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080/;
}
}
It tells Nginx to redirect the traffics from port 80 to Apache Tomcat on port 8080. Done, restart Nginx. 它告诉Nginx将流量从端口80重定向到端口8080上的Apache Tomcat。完成后,重新启动Nginx。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.