I'm trying to setup a Tomcat server.
The following is my VirtualHost config
<VirtualHost <hosting's ip>:80>
ServerName myapp.com
ServerAlias mail.myApp.com www.myapp.com
# DocumentRoot /home/myappco/public_html
ServerAdmin webmaster@myapp.com
UseCanonicalName Off
<IfModule userdir_module>
<IfModule !mpm_itk.c>
<IfModule !ruid2_module>
<IfModule !mod_passenger.c>
UserDir enabled myappco
</IfModule>
</IfModule>
</IfModule>
</IfModule>
<IfModule include_module>
<Directory "/home/myappco/public_html">
SSILegacyExprParser On
</Directory>
</IfModule>
<IfModule suphp_module>
suPHP_UserGroup myappco myappco
</IfModule>
<IfModule suexec_module>
<IfModule !mod_ruid2.c>
SuexecUserGroup myappco myappco
</IfModule>
</IfModule>
<IfModule ruid2_module>
RMode config
RUidGid myappco myappco
</IfModule>
<IfModule mpm_itk.c>
AssignUserID myappco myappco
</IfModule>
<IfModule mod_passenger.c>
PassengerUser myappco
PassengerGroup myappco
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ /home/myappco/public_html/cgi-bin/
</IfModule>
<IfModule rewrite_module>
RewriteOptions Inherit
</IfModule>
<IfModule proxy_fcgi_module>
<FilesMatch \.(phtml|php[0-9]*)$>
SetHandler proxy:unix:/opt/cpanel/ea-php71/root/usr/var/run/php-fpm/11fd7156a043fa23ad7e496c622a3f2dcd557177.sock|fcgi://myapp.com
</FilesMatch>
</IfModule>
# To customize this VirtualHost use an include file at the following location
Include "/etc/apache2/conf.d/userdata/std/2_4/myappco/myapp.com/*.conf"
</VirtualHost>
I was following this tutorial https://documentation.cpanel.net/display/EA4/Tomcat+Proxies, since this was included in the README.APACHE-PROXY, so I basically added my proxy in the indicated *.conf file:
<IfModule proxy_ajp_module>
ProxyPass "/myapp" "ajp://localhost:10001/myapp"
ProxyPassReverse "/myapp" "ajp://localhost:10001/myapp"
</IfModule>
The following is my server.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server port="-1" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources>
<Service name="Catalina">
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" deployOnStartup="true" deployXML="false">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/>
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false"/>
</Host>
</Engine>
<Connector port="10001" protocol="AJP/1.3" xpoweredBy="false" secretRequired="false" enableLookups="true"/>
</Service>
</Server>
It looks like the proxy is working fine, since I see a 302 redirect Status in Chrome Dev Tools, but I get a 404 when it queries for the application, even though the Tomcat startup worked fine, indicating that ajp connector is listening. Please help. I'm running out of options.
The issue was stemming from a misconfigured POM file where the index.html file was being placed somewhere else in the war file. I simply changed the destination directory pathing to fix this issue. Apologies for the stupid error.