在同一端口上运行两个Web应用程序? [英] Running two web applications on same port?

查看:151
本文介绍了在同一端口上运行两个Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有两个不同的Java Web应用程序,分别名为foo.war和bar.war,我们希望将它们部署在Jetty服务器上

We have two different Java web apps named foo.war and bar.war and we want to deploy these on Jetty server

Jetty在机器的8080端口上运行

Jetty is running on 8080 port on the machine

是否可以在同一端口上同时运行两个应用程序?如果没有,在同一码头服务器上运行多个Web应用程序的替代方案是什么

Is it possible simultaneously run two apps on same port ? If no what are the alternatives to run multiple web apps on same jetty server

谢谢

推荐答案

您可以在servlet容器中运行任意数量的Web应用程序.他们只需要不同的上下文根.

You can run as many web applications as you want in a servlet container. They just need different context roots.

假设您有abc.war和def.war.如果同时部署两者,则默认情况下可以通过http://localhost:8080/abchttp://localhost:8080/def进行访问.

Let's say you have abc.war and def.war. If you deploy both, by default you can access them through http://localhost:8080/abc and http://localhost:8080/def.

由于这通常看起来很难看,因此最好在Servlet容器的前面放置一个反向代理.例如,这将使您拥有2个不同的域foobar.comxipbaz.com,然后将它们路由到不同的应用程序,即使它们都位于同一服务器上.

Since this usually looks ugly, it's a good idea to put a reverse proxy in front of your Servlet container. This will allow you to have for example 2 different domains foobar.com and xipbaz.com that will then be routed to different applications, even if they're all on the same server.

这篇关于在同一端口上运行两个Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆