简体   繁体   中英

Using mod_proxy_cluster and mod_proxy in one VirtualHost of Apache (httpd) configuration

I had the environment with several JBoss and Tomcat servers. They are connected to Apache via modcluster modules (to Apache IP address and port 8090). The Apache contains the configuration:

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>  

All work ok but one new application doesn't support connection to Apache. I need to use ProxyPass. When I insterted the ProxyPass to 443 virtual host so all balanced contexts stopped to work. When I inserted: ProxyPass / balancer://My_Cluster The /other_app context stopped work.

Can you advise me how configure context /other_app handling by ProxyPass and all other contexes by modcluster balancer?

Try using the following top level directive (add just below the LoadModule's)

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

Managed to do it with the following:

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

Inspired by https://serverfault.com/questions/363788/serve-all-requests-via-proxy-except-a-specific-one

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM