Nuñito Calzada
Nuñito Calzada

Reputation: 1676

Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04

I tried to install Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04, after installing tomcat and test that works fine:

http://139.162.221.XXX:8080/tomcat-demo/helloworld/

I installed and configured mod_jk :

sudo apt-get install libapache2-mod-jk

uncomment the following line <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> in the file etc/tomcat7/server.xml

add this:

# Define 1 real worker using ajp13 
worker.list=worker1 
# Set properties for worker (ajp13) 
worker.worker1.type=ajp13 
worker.worker1.host=localhost
worker.worker1.port=8009

to /etc/apache2/workers.properties

change the JkWorkersFile property to /etc/apache2/workers.properties in the file /etc/apache2/mods-available/jk.conf

edit the file: /etc/apache2/sites-enabled/000-default

to add

<VirtualHost *:80>
.......................................
.......................................
JkMount /tomcat-demo/* worker1
JkMount /tomcat-demo worker1
</VirtualHost *:80>

restart the servers:

sudo /etc/init.d/tomcat7 restart
sudo /etc/init.d/apache2 restart

but accessing to http://139.162.221.XXX/tomcat-demo/helloworld/

I got this error:

Not Found

The requested URL /tomcat-demo/helloworld/ was not found on this server.

Apache/2.4.7 (Ubuntu) Server at 139.162.221.107 Port 80

and I have also this error restart Apache:

 * Restarting web server apache2                                                                                                                                 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message

Upvotes: 0

Views: 1341

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48087

Not sure how the wildcard resolution actually is done, I typically have two JkMounts:

JkMount /tomcat-demo   worker1
JkMount /tomcat-demo/* worker1

(This might be superfluous, but I like this declaration better than the one you quote, which would also include /tomcat-demo7 and other paths)

Also, make sure you don't have multiple VirtualHost declarations and only a certain host name actually has the JkMount active. Make sure that your workers.properties is actually read (log files, or introduce syntax error and make sure that it's recognized)

Upvotes: 0

Related Questions