rgcanavezzi
(usa CentOS)
Enviado em 04/03/2021 - 14:33h
Olá, já tentei de tudo e segui todos os tutoriais na internet, parece que minha configuração tá certa, a página de início do tomcat e do apache abrem normalmente porém quando testo no navegador a integração com o mod_jk continuo tendo "not found" se alguém mais experiente conseguir me ajudar ficarei muito grato!
Segue o cenário utilizado e o procedimento realizado:
Cenário
CentOS Linux release 7.9.2009 (Core)
Apache/2.4.6 (CentOS)
Tomcat 9.0.43
tomcat-connectors-1.2.48 (mod_jk)
tomcat-native-1.2.26
yum install httpd-* apr-devel openssl-devel cpp gcc-c++ java-1.8.0-openjdk-devel
groupadd tomcat
useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat
mkdir /opt/tomcat
tar zxf /opt/apache-tomcat-9.0.43.tar.gz -C /opt/tomcat --strip-components=1
chmod -R 775 /opt/tomcat && chown -R tomcat:tomcat /opt/tomcat
vim /opt/tomcat/conf/server.xml
Descomentar o conteúdo abaixo para integração com o mod_jk
<Connector protocol="AJP/1.3"
address="::1"
port="8009"
redirectPort="8443" />
cat << EOF > /etc/systemd/system/tomcat.service
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target
[Service]
Type=forking
Environment=$JAVA_HOME
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=$CATALINA_HOME
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
EOF
cat << EOF > /etc/profile.d/javahome.sh
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))
export CATALINA_HOME=/opt/tomcat
EOF
source /etc/profile.d/javahome.sh
chmod 755 /opt/tomcat-native-1.2.26-src.tar.gz
mkdir /opt/tomcat-native-1.2.26-src
tar zxf /opt/tomcat-native-1.2.26-src.tar.gz -C /opt/tomcat-native-1.2.26-src --strip-components=1
cd /opt/tomcat-native-1.2.26-src/native/
./configure --with-apr=/usr/bin/apr-1-config --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=/
make && make install
chmod 755 /opt/tomcat-connectors-1.2.48-src.tar.gz
mkdir /opt/tomcat-connectors-1.2.48-src
tar zxf /opt/tomcat-connectors-1.2.48-src.tar.gz -C /opt/tomcat-connectors-1.2.48-src --strip-components=1
cd /opt/tomcat-connectors-1.2.48-src/native
./configure --with-apxs=/usr/bin/apxs
make && make install
cat << EOF > /etc/httpd/conf.d/mod_jk.conf
# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf.d/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel error
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicate to send SSL KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile logs/jk.shm
EOF
cat << EOF > /etc/httpd/conf.d/workers.properties
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.1
worker.worker1.port=8009
EOF
cat << EOF > /etc/httpd/conf.d/vhosts.conf
<VirtualHost *:80>
JkMount /examples/* worker1
</VirtualHost>
EOF
systemctl enable httpd && systemctl enable tomcat && systemctl daemon-reload && systemctl start httpd && systemctl start tomcat && systemctl status httpd && systemctl status tomcat
http://centos7lab
http://centos7lab:8080/
Teste final da página com o mod_jk:
http://centos7lab/events