Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Apache 2.4 AJP proxy to Tomcat Example
<VirtualHost *:443>
# General setup for the virtual host
DocumentRoot "/srv/www/htdocs"
ServerName host.example.com
ServerAdmin webmaster@example.com
ErrorLog /var/log/apache2/error_log
TransferLog /var/log/apache2/access_log
CustomLog /var/log/apache2/host.example.com-ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
SSLEngine On
SSLCertificateFile /etc/apache2/ssl.crt/host.example.com.crt
SSLCertificateKeyFile /etc/apache2/ssl.key/host.example.com.key
ProxyRequests Off
ProxyTimeout 20
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
AddDefaultCharset off
#### You must accept proxy from everywhere *
## Old Apache2 (before 2.4) syntax
#Order allow,deny
#allow from all
## Apache 2.4 syntax
Require all granted
Satisfy Any
</Proxy>
ProxyPass /app1 ajp://{Tc1ipaddress}/app1
ProxyPassReverse /app1 ajp://{Tc1ipaddress}:8009/app1
ProxyPass /app2 ajp://{Tc1ipaddress}:8009/app2
ProxyPassReverse /app2 ajp://{Tc1ipaddress}:8009/app2
#Tomcat Cluster example
#<Proxy balancer://tccluster>
#BalancerMember ajp://{Tc2ipaddress}:8009 route=jvm1
#BalancerMember ajp://{Tc3ipaddress}:8009 route=jvm2
#</Proxy>
#ProxyPass /app3 balancer://tccluster/app3 stickysession=JSESSIONID nofailover=Off
#ProxyPassReverse /app3 balancer://tccluster/app3
SetEnvIf User-Agent ".*MSIE [1-5].*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
SetEnvIf User-Agent ".*MSIE [6-9].*" \
ssl-unclean-shutdown
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment