Skip to content

Instantly share code, notes, and snippets.

@4np
Last active December 11, 2015 15:29
Show Gist options
  • Save 4np/4621422 to your computer and use it in GitHub Desktop.
Save 4np/4621422 to your computer and use it in GitHub Desktop.
Apache virtual host containing a load balanced proxy configuration to GSCF running on Apache Tomcat 7.x
<VirtualHost *:80>
ServerName studies.dbnp.org
ServerAlias gscf.dbnp.org
ErrorLog /var/log/apache2/dbnp.org_gscf-studies-error.log
CustomLog /var/log/apache2/dbnp.org_gscf-studies-access.log combined
# disable gzip encoding for monitoring page
<Location /monitoring>
RequestHeader unset Accept-Encoding
AuthType Basic
Order deny,allow
Deny from all
AuthName "Restricted to Authorized users only"
AuthUserFile /var/www/users
AuthGroupFile /var/www/groups
Require group nmcdsp
Allow from env=allowed
Satisfy any
</Location>
<IfModule mod_rewrite.c>
RewriteEngine on
# keep listening for the serveralias, but redirect to
# servername instead to make sure only one user session
# is created (tomcat will create one user session per
# domain which may lead to two (or more) usersessions
# depending on the number of serveraliases)
# see gscf ticket #321
RewriteCond %{HTTP_HOST} !^studies.dbnp.org$ [NC]
RewriteRule ^(.*)$ http://studies.dbnp.org$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^studies.dbnp.org$ [NC]
RewriteCond %{REQUEST_URI} ^/gscf-www/ [NC]
RewriteRule ^/gscf-www/(.*)$ /$1 [L,PT,NC,NE]
</IfModule>
<IfModule mod_proxy.c>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyStatus On
ProxyPreserveHost On
ProxyPass / balancer://gscf-cluster/gscf-www/ stickysession=JSESSIONID|jsessionid nofailover=On
ProxyPassReverse / balancer://gscf-cluster/gscf-www/
ProxyPassReverseCookiePath /gscf-www /
ProxyTimeout 900
<Location />
SetOutputFilter proxy-html
ProxyHTMLDoctype XHTML Legacy
ProxyHTMLURLMap /gscf-www/ /
</Location>
<Proxy balancer://gscf-cluster>
#BalancerMember ajp://localhost:8009
BalancerMember http://11.22.33.44:8080
</Proxy>
</IfModule>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment