Install the latest version of Apache httpd 2.4 on Cent OS 8 from source Install Tomcat 9 on Cent OS 8 Link the two installed here.
Please note that the default value has changed since Tomcat: v9.0.31.
Modify httpd.conf and create httpd-proxy.conf.
vi /usr/local/apache2/conf/httpd.conf
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
This is commented out, so uncomment it and enable it.
To read the httpd-proxy.conf to be created next, add the following contents at the end.
Include conf/extra/httpd-proxy.conf
Specify the path you want to link.
vi /usr/local/apache2/conf/extra/httpd-proxy.conf
httpd-proxy.conf
<Location /docs/>
ProxyPass ajp://127.0.0.1:8009/docs/
</Location>
systemctl restart httpd
Change the settings in server.xml.
vi /opt/apache-tomcat/conf/server.xml
<Connector protocol="AJP/1.3"
address="::1"
port="8009"
secretRequired="false"
redirectPort="8443" />
Items related to AJP have been commented out, so uncomment them and enable them. It is non-secure, but the secretRequired option must be false. Depending on the network environment, it may not work unless you take "address =" :: 1 "".
<!--
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
The default port of Tomcat (port number 8080) is enabled, so comment out the above settings.
systemctl restart tomcat
It is OK if you can access with the address without the port number. http://hostname/docs/
Now you can link Apache httpd 2.4 with Tomcat 9.
Recommended Posts