Reputation: 47
I'm trying to set an apache2 server in front of a tomcat 10 installation on a ubuntu server in a virtual box environment. Both apache and tomcat work good by themself. I want to use apache with mod_jk to redirect some request to tomcat. Here my steps. in server.xml of tomcat I've decommeneted the following lines:
<Connector protocol="AJP/1.3"
address="::1"
port="8009"
redirectPort="8443" />
I've installed mod_jk with apt:
sudo apt-get install libapache2-mod-jk
I've edited the workers.properties file in /etc/libapache2-mod-jk:
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
In /etc/apache2/apache.conf:
JkWorkersFile /etc/libapache2-mod-jk/workers.properties
JkMount /sample/* worker1
On the server address i can see the apache home page, and in serveraddress:8080/sample I can see the tomcat sample page. I'm now expeting to see the tomcat sample page also in serveraddress/sample. But i get a 404 error. Am I missing some steps?
Thank you.
Upvotes: 0
Views: 546
Reputation: 68
Does /var/log/apache2/mod_jk.log tell you anything? (apart from workers jk-manager and jk-status missing as they're set by default mod-jk conf)
Did you enable mod_jk in Apache (sudo a2enmod jk
) and restart Apache (sudo service apache2 restart
)?
Which version of Ubuntu are you using?
Regards the latter, be aware that a regression bug slipped into libapache2-mod-jk for Debian/Ubuntu in renaming jk.conf to httpd.conf which meant using a2enmod
doesn't work.
Note the issue here: https://changelogs.ubuntu.com/changelogs/pool/universe/liba/libapache-mod-jk/libapache-mod-jk_1.2.46-2/changelog
Said bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928813
This burnt me big time using Unbuntu 20.04 LTS. If this is the case for you, enable mod-jk by adding a symlink to /etc/apache2/mods-available/httpd.conf in /etc/apache2/mods-enabled/
The bug didn't reach Unbuntu 18.04 LTS using a vanilla install of sudo apt install libapache2-mod-jk
. Not sure on when/where/how fixes trickle down from upstream Debian to Ubuntu
HTH
Upvotes: 2