-
Notifications
You must be signed in to change notification settings - Fork 0
tomcat with systemd
gluehloch edited this page Jul 19, 2021
·
5 revisions
Ich verwende das Apache Plugin 'proxy'. Dieser leitet die HTTP Anfragen an den Tomcat Server weiter.
Die Datei proxy.conf für die Apache Installation.
In der Tomcat Konfiguration in der server.xml wird der
AJP auskommentiert.
<IfModule mod_proxy.c>
# If you want to use apache2 as a forward proxy, uncomment the
# 'ProxyRequests On' line and the <Proxy *> block below.
# WARNING: Be careful to restrict access inside the <Proxy *> block.
# Open proxy servers are dangerous both to your network and to the
# Internet at large.
#
# If you only want to use apache2 as a reverse proxy/gateway in
# front of some web application server, you DON'T need
# 'ProxyRequests On'.
#ProxyRequests On
#<Proxy *>
# AddDefaultCharset off
# Require all denied
# #Require local
#</Proxy>
<Proxy *>
Require all granted
</Proxy>
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#ProxyVia Off
ProxyPass /betoffice-jweb ajp://localhost:8009/betoffice-jweb smax=0 ttl=60 retry=5
ProxyPass /registrationservice ajp://localhost:8009/registrationservice smax=0 ttl=60 retry=5
</IfModule>
/etc/systemd/system/tomcat.service
systemctl daemon-reload
systemctl status tomcat
systemctl start tomcat
systemctl stop tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/opt/devtools/java/jdk-16.0.1
Environment=CATALINA_PID=/opt/devtools/apache-tomcat/tomcat-prod/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/devtools/apache-tomcat/tomcat-prod
Environment=CATALINA_BASE=/opt/devtools/apache-tomcat/tomcat-prod
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/devtools/apache-tomcat/tomcat-prod/bin/startup.sh
ExecStop=/opt/devtools/apache-tomcat/tomcat-prod/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
by Andre Winkler 2021, Hamburg