tomcat with systemd - gluehloch/java-examples GitHub Wiki
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>/<TOMCAT>/conf/server.xml
- TODO Das Attribut
secretRequired´: Kann ich das Attribut einsetzen? Und was ist dafür zu tun?
<Connector protocol="AJP/1.3" port="8009" redirectPort="8443" secretRequired="false"/>
/etc/systemd/system/tomcat.servicesystemctl 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