[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

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

Apache autostart settings

[root@akagi ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@akagi ~]# 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

[root@akagi ~]# cd /etc/httpd/conf/
[root@akagi 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

[root@akagi ~]# 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