Tomcat ajp13 connector returns 404 for all requests

tomcat

I'm sure the answer is simple, but I'm tearing my hair out.
I'm rebuilding an apache httpd + tomcat site on a new Ubuntu 16 system with Apache 2.4 and Tomcat 8.5.23.
I have tomcat running and the ajp13 connector appears to be running, but requests to http://abilities.tld/ give 404.
The 404 shows up in the mod_jk.log as originating from tomcat, so it's not a simple httpd 404.

Abbreviated vhost config

<VirtualHost 1.1.1.1:80>
    DocumentRoot "/home/user/subdir/html"
    ServerName abilities.tld
    ServerAlias www.abilities.tld
    <Directory "/home/user/subdir/html">
            allow from all
            Options ExecCGI Includes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>

    SuexecUserGroup user user

    JkMount /* ajp13
    #Directives to enable Apache to continue serving applications dependent on it.
    SetEnvIf Request_URI "/webmail*" no-jk
    SetEnvIf Request_URI "/mail*" no-jk
    SetEnvIf Request_URI "/awstats*" no-jk
    SetEnvIf Request_URI "/myadmin*" no-jk
    SetEnvIf Request_URI "/pgadmin*" no-jk
    SetEnvIf Request_URI "/cgi-bin*" no-jk

    #DirectoryIndex /abilities

`

Apache vhost log
2.2.2.2 – – [16/Nov/2017:14:08:18 +1100] "GET / HTTP/1.1" 404 164

Visiting http://1.1.1.1:8080/host-manager/html works fine and shows the virtual hosts

The catalina log shows the startup deployment of WARs as expected.

In server.xml

     <Host appBase="/home/user/subdir/html" name="abilities.tld" unpackWARs="true" autoDeploy="true">
            <Alias>www.abilities.tld</Alias>
            <Context path="" docBase="abilities" debug="0" reloadable="true"/>
            <Logger className="org.apache.catalina.logger.FileLogger" prefix="abilities.tld" suffix=".txt" timestamp="true"/>
      </Host>

and in /var/log/apache2/mod_jk.log

[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1179): Attempting to map URI '/' from 1 maps
[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] find_match::jk_uri_worker_map.c (978): Attempting to map context URI '/*=ajp13' source 'JkMount'
[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] find_match::jk_uri_worker_map.c (991): Found a wildchar match '/*=ajp13'
[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] jk_handler::mod_jk.c (2823): Into handler jakarta-servlet worker=ajp13 r->proxyreq=0
[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] wc_get_worker_for_name::jk_worker.c (120): found a worker ajp13
[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] wc_get_name_for_type::jk_worker.c (304): Found worker type 'ajp13'
[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] init_ws_service::mod_jk.c (1196): Service protocol=HTTP/1.1 method=GET ssl=false host=(null) addr=1.178.147.184 name=abilities.tld port=80 auth=(null) user=(null) laddr=103.18.42.17 raddr=1.178.147.184 uaddr=1.178.147.184 uri=/
[Thu Nov 16 14:46:53.105 2017] [26722:140421309081472] [debug] ajp_get_endpoint::jk_ajp_common.c (3351): (ajp13) acquired connection pool slot=0 after 0 retries
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] ajp_marshal_into_msgb::jk_ajp_common.c (684): (ajp13) ajp marshaling done
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] ajp_service::jk_ajp_common.c (2586): processing ajp13 with 2 retries
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] jk_shutdown_socket::jk_connect.c (932): About to shutdown socket 37         [127.0.0.1:50968 -> 127.0.0.1:8009]
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] jk_is_input_event::jk_connect.c (1406): error event during poll on socket 37 [errno=107] (event=24)
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] jk_shutdown_socket::jk_connect.c (1016): Shutdown socket 37 [127.0.0.1:50968 -> 127.0.0.1:8009] and read 0 lingering bytes in 0 sec.
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] ajp_send_request::jk_ajp_common.c (1639): (ajp13) failed sending request, socket 37 is not connected any more (errno=0)
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] ajp_abort_endpoint::jk_ajp_common.c (821): (ajp13) aborting endpoint with socket 37
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] ajp_send_request::jk_ajp_common.c (1717): (ajp13) no usable connection found, will create a new one, detected by connect check (1), cping (0), send (0).
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] jk_open_socket::jk_connect.c (675): socket TCP_NODELAY set to On
[Thu Nov 16 14:46:53.106 2017] [26722:140421309081472] [debug] jk_open_socket::jk_connect.c (799): trying to connect socket 37 to 127.0.0.1:8009
[Thu Nov 16 14:46:53.107 2017] [26722:140421309081472] [debug] jk_open_socket::jk_connect.c (825): socket 37 [127.0.0.1:58717 -> 127.0.0.1:8009] connected
[Thu Nov 16 14:46:53.107 2017] [26722:140421309081472] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (1267): sending to ajp13 pos=4 len=704 max=8192
......
[Thu Nov 16 14:46:53.172 2017] [26722:140421309081472] [debug] ajp_unmarshal_response::jk_ajp_common.c (739): (ajp13) status = 404

Where else can I look to figure out why tomcat is giving 404?

Thanks

Best Answer

So the answer was that the tomcat vhost was failing to load and the web request was being served by the localhost (default) vhost. Hence the 404.

Related Topic