[LINUX] Integrate Apache and Tomcat

Introduction

As a continuation of Tomcat installation and auto-start settings, I summarized the settings to throw the HTTP request received on the Apache side to Tomcat.

Environment used

Apache installation

[[email protected] ~]# yum install -y httpd
[[email protected] ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Aug  8 2019 11:41:18

Apache autostart settings

[[email protected] ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[[email protected] ~]# systemctl list-unit-files -t service | grep httpd
httpd.service                                 enabled 

Edit configuration file

Check /etc/httpd/conf.modules.d/00-proxy.conf

00-proxy.conf


# This file configures all the proxy modules:
LoadModule proxy_module modules/mod_proxy.so
...
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
...

Backup of httpd.conf

[[email protected] ~]# cd /etc/httpd/conf/
[[email protected] conf]# cp -a httpd.conf httpd.conf.org

Reverse proxy settings

/etc/httpd/conf/httpd.conf


#Add the following to the end of the file
ProxyPass /tomcat9/ ajp://localhost:8009/
ProxyPassReverse /tomcat9/ ajp://localhost:8009/

/etc/httpd/conf/httpd.conf


#Add the following to the end of the file
ProxyPass /tomcat9/ ajp://localhost:8009/test/
ProxyPassReverse /tomcat9/ ajp://localhost:8009/test/

Reflection of settings

[[email protected] ~]# systemctl reload httpd

Confirmation of operation

image.png

Related work

Recommended Posts

Integrate Apache and Tomcat
How to integrate Apache httpd 2.4 and Tomcat 9 on Cent OS 8
Let's integrate Django and apache (httpd) on Mac! !!
Apache mod_auth_tkt and Python AuthTkt
Apache Flink Challenges and Opportunities
Tomcat installation and autostart settings
Integrate Modelica and Python on Windows
Until you install Apache and Tomcat on Linux (CentOS) and deploy Java apps
CentOS 6.4 with Python 2.7.3 with Apache with mod_wsgi and Django
Easily organize the differences between Apache Tomcat