<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: More JBoss-AS 5 clusters and more Apache Virtual Hosts
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/augustsimonelli">August Simonelli</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/575990#575990">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Here's what I wound up doing with our mod_cluster 1.0.4/EAP5.1 setup. I don't use multicast so keep that in mind ...</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>mod_cluster.conf:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>LoadModule slotmem_module modules/mod_slotmem.so<br/>LoadModule manager_module modules/mod_manager.so<br/>LoadModule proxy_cluster_module modules/mod_proxy_cluster.so<br/>LoadModule advertise_module modules/mod_advertise.so</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Listen 127.0.0.1:6666<br/>&lt;VirtualHost 127.0.0.1:6666&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; &lt;Directory /&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Order deny,allow<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Deny from all<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Allow from 127.0.0.1<br/>&#160;&#160;&#160; &lt;/Directory&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; KeepAliveTimeout 60<br/>&#160;&#160;&#160; MaxKeepAliveRequests 0</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; ManagerBalancerName mycluster<br/>&#160;&#160;&#160; AdvertiseFrequency 5<br/>&#160;&#160;&#160; ServerAdvertise Off</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; Createbalancers 1</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><br/>&lt;/VirtualHost&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>"Createbalancers 1" means we can don't automatically have the balancer in all virtuals, which i like cause it means i can have non-mod-clustered virtuals for static files/other sites/etc. ALL JBoss instances hit this 6666 port (in this case it's on localhost but obviously in reality you'd need it exposed).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>0.conf:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;VirtualHost *:80&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ServerName redcloud.local<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; DocumentRoot /var/www/html/redcloud/<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ErrorLog logs/redcloud.local-error_log<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; CustomLog logs/redcloud.local-access_log common<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; LogLevel debug</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Location /mod_cluster-manager&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SetHandler mod_cluster-manager<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Order deny,allow<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Deny from all<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Allow from 127 192<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Location&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;/VirtualHost&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>a hacky way to ensure the default virtual is this one. i like this cause it allows me to use it as my "working" virtual with my clustermanager and such. i tend to attach my hostname to it cause that's logical in my mind.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>virtual.conf</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>NameVirtualHost *:80</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;VirtualHost *:80&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ServerName modcluster.redcloud.local<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; DocumentRoot /var/www/html/cluster<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ErrorLog logs/modcluster.redcloud.local-error_log<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; CustomLog logs/modcluster.redcloud.local-access_log common<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; LogLevel debug</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ProxyPass / balancer://ogbalancer/sample stickysession=JSESSIONID|jsessionid <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; ProxyPassReverse / balancer://ogbalancer/sample</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; #RewriteEngine on</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; #RewriteCond %{REQUEST_URI} !/mod_cluster-manager<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; #RewriteRule ^/(.*)$ balancer://ogbalancer/sample/$1 [P,L]<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; #RewriteRule ^/(.*)$ balancer://ogbalancer/$1 [P,L]<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; #RewriteRule ^/sample/(.*)$ balancer://ogbalancer/sample/$1 [P,L]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;/VirtualHost&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>because of "createbalancers 1" each virtual needs the balancer created with a proxypass line. So in this example I create ogbalancer for this virtual only. On the jboss side, besides the jbossweb changes needed by 1.0.4, i add</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;property name="balancer"&gt;ogbalancer&lt;/property&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>to ./deploy/mod-cluster.sar/META-INF/mod-cluster-jboss-beans.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>This links the jboss instance to that virtual only. If i have another virtual it won't pass anything to ogbalancer unless i give it a proxypass line for that balancer within the virtual.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Now, i can stand up another jboss instance, connect it to the same 6666 port (in my case with jboss.modcluster.proxyList) as all the others, set ITS balancer name:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;property name="balancer"&gt;someotherbalancer&lt;/property&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>And then call that balancer from another virtual host with its own proxypass line. Now all traffic for this virtual goes to that JBoss instance, and all traffic for my example virtual goes to ogbalancer.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Should work fine with mutlicast; we just have network implications for using that.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>August</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>BTW ... i left the rewrite stuff i was using in as it does work, but i&#160; think the proxypass stuff makes more sense. plus when it comes to&#160; passing querystrings with mod_rewrite i ran into this:&#160; </span><a class="jive-link-external-small" href="http://community.jboss.org/message/521202#521202" target="_blank">http://community.jboss.org/message/521202</a><span> ...</span></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/575990#575990">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>