1

将 Tomcat 配置为具有两个 localhost 实例的最聪明的方法是什么?

请注意,我没有系统管理员权限,因此无权访问 /etc/hosts 文件。我希望能够执行以下操作,但无法修改我的 /etc/hosts 文件:http: //juststuffreally.blogspot.com/2007/03/enabling-multiple-localhost-sites-in.html

我想要这样的东西,以便我的 localhost 实例如下所示:

keith.localhost.com joe.localhost.com

...但我无法修改我的 /etc/hosts 文件 =-(

我发现的另一个资源是这个,但这给出了多个外部域的说明——我需要多个 localhost 实例:http: //iam-rakesh.blogspot.com/2009/10/hosting-multiple-domains-in-tomcat。 html

有任何想法吗?

感谢您的帮助。

4

1 回答 1

3

您可以在多个端口上运行多个 tomcat 实例。每个实例都需要一个唯一server.xml的,并且每个实例都需要在适当的<Server><Connector>元素中定义不同的端口。

设置好所有内容后,您将在连接到实例时指定一个显式端口,例如:

- http://localhost:8080/
- http://localhost:8081/

本文档更详细地介绍了该过程。

于 2012-04-24T15:05:59.030 回答