[{ALLOW view All}]
[{ALLOW edit Markus}]
!!Connect Apache HTTP Webserver with Tomee (Tomcat)
There are many solutions with rewrite rules in the web.\\
But there is a mod called mod_jk which uses th AJP 1.3 Connector easily, see
[https://community.jaspersoft.com/wiki/connecting-apache-web-server-tomcat-and-writing-re-direct-rules]
This connector is enabled by default at ../tomee/conf/server.xml
{{{
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
}}}
Note: Finally if you have Apache HTTP in front of Tomee/Tomcat you can disable connectors for port 80 and 443 here, too!
!Install mod_jk
{{{
> sudo apt-get install libapache2-mod-jk
libapache-mod-jk-doc tomcat8
Die folgenden NEUEN Pakete werden installiert:
libapache2-mod-jk
Holen:1 http://ftp.de.debian.org/debian stretch/main amd64 libapache2-mod-jk amd64 1:1.2.42-1 [163 kB]
libapache2-mod-jk (1:1.2.42-1) wird eingerichtet ...
apache2_invoke: Enable module jk
}}}
Restart
{{{
/etc/init.d/apache2 restart
}}}
!Configure
Check for a worker.properties file in /etc/apache2/mods-available/jk.conf \\
Use default at
{{{
vi /etc/libapache2-mod-jk/workers.properties
}}}
Optionally: Create worker on your own (not necessary!)
{{{
vi /etc/apache2/workers.properties file:
# Define 1 real worker using ajp13
worker.list=ajp13_worker
# Set properties for ajp13_worker (ajp13)
worker.ajp13_worker.type=ajp13
worker.ajp13_worker.host=localhost
worker.ajp13_worker.port=8009
Connect worker in config
vi /etc/apache2/conf-available/modjk.conf
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[ %a %b %d %H:%M:%S %Y ] "
Enable Conf
a2enconf modjk.conf
a2disconf modjk.conf
}}}
!Configure mod_jk
Set tomacat home and java home.
To get your java home use
{{{
readlink -f /usr/bin/java | sed "s:bin/java::"
=> /usr/lib/jvm/java-8-openjdk-amd64/jre/
}}}
Edit
{{{
vi /etc/libapache2-mod-jk/workers.properties
workers.tomcat_home=<yourhome>
workers.java_home=/usr/lib/jvm/default-java
}}}
Add Tomee sites
{{{
vi /etc/apache2/sites-enabled/000-default.conf
add under "DocumentRoot":
JkMount /JSPWiki* ajp13_worker
JkMount /Homepage* ajp13_worker
Note: Check Port in VirtualHost element and adjust if not 80 !!!!
}}}
Restart (see above)