Introduction
How do I proxy from Apache to Tomcat
Procedure
First, you need to determine the AJP port from the Tomcat configuration in /home/$USER/ea-tomcat85/conf/server.xml:
# grep 'Connector port.*AJP' /home/$USER/ea-tomcat85/conf/server.xml
<Connector port="10005" protocol="AJP/1.3" xpoweredBy="false" secretRequired="false"/>
This shows that the AJP port for this domain is going to be 10005.
Once you know the port you can create the include files for the domain: You will need to make sure the parent directories are created before creating the file.
<IfModule proxy_ajp_module>
ProxyPass "/" "ajp://127.0.0.1:$PORT/"
</IfModule>
/etc/apache2/conf.d/userdata/ssl/2_4/$username/$domain.tld/tomcatproxypass.conf:
<IfModule proxy_ajp_module>
ProxyPass "/" "ajp://127.0.0.1:$PORT/"
</IfModule>
Note:
If you are loading a website from the document root of the domain you may need to use another path for the ProxyPass statement other than /, for instance, if you want your Tomcat application to load from /javaapp you will add the following statement to the Apache include:
<IfModule proxy_ajp_module>
ProxyPass "/javaapp" "ajp://127.0.0.1:$PORT/"
</IfModule>
After you create the proxies you will need to restart Apache:
/scripts/restartsrv_httpd
Comments
0 comments
Article is closed for comments.