将地址映射到多个tomcat实例

发布于 2024-12-28 09:14:18 字数 1002 浏览 4 评论 0原文

我有 3 个 tomcat 实例在 Windows Server 2008 机器上运行。每一个都有一个应用程序:

如何配置我的服务器来映射没有端口号的地址?

是tomcat配置还是带DNS的东西?

谢谢。


好的,我尝试了以下操作:

  • 设置 Apache 2.2
  • 配置 httpd.conf 加载代理模块
  • 并添加代理模块配置:

    代理请求关闭
    ProxyPass /app1 http://machine:8081/app
    ProxyPassReverse /app1 http://machine:8081/app
    
    <位置“/app”>
      订单允许、拒绝
      允许所有
    
    

现在重定向在计算机本地运行良好。但当我尝试从同一网络中的另一台计算机访问时,它不起作用。 (这另一台机器可以 ping '机器' 主机。我也尝试输入 IP 号码)。

I have 3 tomcat instances running on Windows Server 2008 machine. Each one with one app:

How I can configure my server to map an address without the port number?

Is it a tomcat configuration or something with DNS?

Thanks.


Ok, I tried the following:

  • Set up the Apache 2.2
  • Configure httpd.conf loading proxy modules
  • And add a proxy module configuration:

    ProxyRequests Off
    ProxyPass /app1 http://machine:8081/app
    ProxyPassReverse /app1 http://machine:8081/app
    
    <Location "/app">
      Order allow,deny
      Allow from all
    </Location>
    

Now the redirect works well local in the machine. But it doesn't works when I try access from another machine in the same network. (this another machine can ping 'machine' host. And I tried putting the ip number too).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

白况 2025-01-04 09:14:18

例如,您可以使用 nginx (http://nginx.org/en/docs/) 作为代理。

简单地尝试(无负载平衡等):

    server {

    listen here.your.ip:80/YourApp;

    location / {
        root /path/to/your/webapp;
        proxy_pass http://host:8080/YourApp;
    }

}

其他端口同样如此

You can use nginx (http://nginx.org/en/docs/) as proxy for example.

Try simply (no load balancing etc.):

    server {

    listen here.your.ip:80/YourApp;

    location / {
        root /path/to/your/webapp;
        proxy_pass http://host:8080/YourApp;
    }

}

Same way for other ports

优雅的叶子 2025-01-04 09:14:18

在 Apache 后面使用多个 Tomcat 来进行负载平衡是很常见的。虽然这不是负载平衡,但原理是相同的。您将拥有 3 个应用程序,每个应用程序包含 1 个 Tomcat Worker,而不是拥有一个具有 3 个负载平衡 Tomcat Worker 的应用程序。

您可以在此处找到 tomcat 文档:http://tomcat.apache.org/connectors-doc/

It is quite common to use multiple Tomcats behind Apache to do load balancing. While this is not load balancing the principle is the same. Instead of having one application with 3 load-balanced Tomcat workers, you would have 3 applications with 1 tomcat worker each.

You can find the tomcat documentation here: http://tomcat.apache.org/connectors-doc/

满天都是小星星 2025-01-04 09:14:18

httpd 中尝试以下代码的 mod 代理配置

ProxyPass           /app0   http://localhost:8080/app0/
ProxyPassReverse    /app0   http://localhost:8080/app0/
ProxyPass           /app1   http://localhost:8081/app1/
ProxyPassReverse    /app1   http://localhost:8081/app1/
ProxyPass           /app2   http://localhost:8082/app2/
ProxyPassReverse    /app2   http://localhost:8082/app2/

Try mod proxy configuration on below code in httpd:

ProxyPass           /app0   http://localhost:8080/app0/
ProxyPassReverse    /app0   http://localhost:8080/app0/
ProxyPass           /app1   http://localhost:8081/app1/
ProxyPassReverse    /app1   http://localhost:8081/app1/
ProxyPass           /app2   http://localhost:8082/app2/
ProxyPassReverse    /app2   http://localhost:8082/app2/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文