在两个不同的端口上运行Tomcat服务器 [英] Running Tomcat server on two different ports

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

问题描述

我想部署一个tomcat服务器,以便它同时侦听两个端口(两者都用于http协议)。

I want to to deploy a tomcat server such that it listens on two ports simultaneously (both for http protocol).

为了确保您了解此要求,我们只有一个服务器实例,但希望在两个端口上侦听HTTP协议。例如,任何人都可以使用端口号7080和8080访问我服务器中部署的应用程序

Just to make sure that you understand this requirement correclty , We have only one server instance but want to listen on two ports for HTTP protocol. For example anybody can access applications deployed in my server using port numbers 7080 and 8080

是否可以这样做?如果可能的话,我们怎样才能实现这个目标?

Is it possible to do that? If possible how can we achive this?

推荐答案

这很简单。您只需要查看 conf / server.xml 配置文件,即可为所需端口添加新连接器。例如,如果您有这样的连接器:

It's very simple. You only need to take a look at the conf/server.xml configuration file to add a new connector for the port you want. For example, if you have a connector like this:

<Connector port="8080" 
           protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" 
           URIEncoding="UTF-8" />

只需在配置文件中添加与上述相同的新连接器,但需要更改端口参数。就这样。重新启动,你就完成了。

Just add a new connector same as above in the configuration file, but altering the port parameter. That's all. Restart and you're done.

这篇关于在两个不同的端口上运行Tomcat服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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