I'm trying to connect the Apache WebServer (2.4.10) to Tomcat 7, both located in two different VMs. It's my first time using those tools. From what I understood a method to check if the connection is working is to try to access to Tomcat using the URL IP/instance instead of, if I have Tomcat on the 8080 port, IP:8080/instance. However, everytime I try to do that, a 404 error is returned by Apache. Here's my configuration:

On the Tomcat's VM, server.xml has the line:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443 />

On the Apache's VM, I have set those files:

apache2.conf (in the Apache main folder)

Servername apache
Include httpd.conf
ServerRoot "/etc/apache2"

Mutex file:${APACHE_LOCK_DIR} default


Timeout 300

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5


HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

Include ports.conf

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied

<Directory /usr/share>
        AllowOverride None
        Require all granted

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

AccessFileName .htaccess

<FilesMatch "^\.ht">
        Require all denied

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

httpd.conf (in the Apache main folder, symbolic link in conf-available and conf-enabled)

LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so

workers.properties (in /etc/libapache2-mod-jk)







jk.conf (in mods-available folder, link in mods-enabled)

JkWorkersFile /etc/libapache2-mod-jk/workers.properties

JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JkShmFile /var/log/apache2/jk-runtime-status

JkWatchdogInterval 60

JkMount     /gameoflife/*   agent1 
JkMount     /gameoflife     agent1
JkMount     /gameoflife*    agent1

<Location /jk-status>
    JkMount jk-status
    Order deny,allow
    Deny from all
    Allow from
<Location /jk-manager>
    JkMount jk-manager
    Order deny,allow
    Deny from all
    Allow from

I know it can be a mess because I tried following different guides and doing everything to have it working but I still get 404 errors. How can I have it working?


For some reasons, it started working once I tried (in the desperation) to implement a load balancer even without the AJP connector working on the single server, given that this was from the beginning my final goal. Ultra happy.

At the end I also wrote the JkMount instructions in the 000-default.conf file in sites-enabled, precisely in the VirtualHost< *:80> istruction. Maybe this was needed in order to work properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.