【问题标题】:Using mod_proxy_cluster and mod_proxy in one VirtualHost of Apache (httpd) configuration在 Apache (httpd) 配置的一个 VirtualHost 中使用 mod_proxy_cluster 和 mod_proxy
【发布时间】:2015-12-06 13:20:07
【问题描述】:

我有几个 JBoss 和 Tomcat 服务器的环境。它们通过 modcluster 模块连接到 Apache(连接到 Apache IP 地址和端口 8090)。 Apache 包含配置:

loadbalancer.conf

LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so

Listen *:8090
<VirtualHost *:8090>

 <Location /mod_cluster_manager>
    SetHandler mod_cluster-manager
    Order deny,allow
    Deny from 8.8.8.8
    Allow from all
  </Location>

  KeepAliveTimeout 60
  MaxKeepAliveRequests 100
  EnableMCPMReceive
  ManagerBalancerName My_Cluster
  AdvertiseFrequency 5

</VirtualHost>

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/ca.crt
    SSLCertificateKeyFile /etc/pki/tls/private/ca.key

ProxyPass /other_app http://192.168.100.70:8080/other_app
ProxyPassReverse /other_app http://192.168.100.70:8080/other_app

ProxyPass / balancer://My_Cluster

</VirtualHost>  

一切正常,但一个新应用程序不支持连接到 Apache。我需要使用 ProxyPass。当我将 ProxyPass 插入到 443 虚拟主机时,所有平衡的上下文都停止工作。当我插入时: ProxyPass / balancer://My_Cluster /other_app 上下文停止工作。

你能告诉我如何配置由 ProxyPass 处理的上下文 /other_app 以及由 modcluster 平衡器处理的所有其他上下文吗?

【问题讨论】:

    标签: apache httpd.conf mod-proxy mod-cluster mod-proxy-balancer


    【解决方案1】:

    尝试使用以下顶级指令(在 LoadModule 的下方添加)

    #This is needed to prevent mod_cluster creating balancer for all VH's
    CreateBalancers 1
    

    【讨论】:

      【解决方案2】:

      通过以下方式设法做到这一点:

      ProxyPass /other_app http://192.168.100.70:8080/other_app
      ProxyPassReverse /other_app http://192.168.100.70:8080/other_app
      ProxyPass /other_app !
      
      ProxyPass / balancer://My_Cluster
      

      灵感来自https://serverfault.com/questions/363788/serve-all-requests-via-proxy-except-a-specific-one

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-10-12
        • 2017-11-26
        • 1970-01-01
        • 2012-03-30
        • 1970-01-01
        • 2016-12-20
        • 2020-06-19
        • 2017-03-27
        相关资源
        最近更新 更多