简体   繁体   中英

I'm unable to get tomcat connectors to work with apache "no match for /jk-status found"

I deployed a springboot application to tomcat, I managed to connect it to the db and now I can access it throw the browser. eg: "www.mydomain.com:8080/spring_app/api/myendpoint" will return a value from SQL.

Of course now I want my angular app located in apache to reach this backend. Since just accessing (localhost:8080/localhost/127.0.0.1) didn't work I found out I needed a connector to map certain requests from apache to tomcat. Tomcat connectors are meant for that. Since I couldn't get my endpoint to work I started to try to get "jk-status" which is a default one to work. I still haven't managed because of the error "no match for /jk-status found".

Apache is clearly trying because whatever I define as a connector in apache's config file will appear in the error shown above".

I'll attach my config and hopefully someone can help me because I've never spent this long trying to solve an issue and not fix it.

-> FIRST FILE (apache config file): "Include httpd-jk.conf".

-> SECOND FILE (apache2/sites-available/api.mydomain.com.conf):

        Require all granted
</Directory>
<VirtualHost *:80>
        ServerName api.mydomain.com
        ServerAlias www.api.mydomain.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/api.mydomain.com/html
        JkMount /jk-status/* jk-status

this last line mounts the jk-status connector which should display info about all the connectors

-> THIRD FILE (html for jk-status): In the document root specified above I have a file called jk-status which contains the connector configuration. (I don't really understand this file but I saw it somewhere).

worker.list=jk-status
worker.jk-status.type=status

-> FOURTH FILE (connector config previously Included in the apache config httpd-jk.conf):

JkWorkersFile /opt/tomcat-connectors-1.2.48-src/conf/workers.properties

Shows the correct path to the workers.properties file

-> FIFTH FILE (workers.properties file):

worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true

This is the default config for jk-status connector.

MOD_JK.LOG

[Mon Jan 09 14:15:58.963 2023] [31374:139970214833088] [debug] jk_servlet_normalize::jk_util.c (2184): URI on entering jk_servlet_normalize: [/jk-status]
[Mon Jan 09 14:15:58.963 2023] [31374:139970214833088] [debug] jk_servlet_normalize::jk_util.c (2278): URI on exiting jk_servlet_normalize: [/jk-status]
[Mon Jan 09 14:15:58.963 2023] [31374:139970214833088] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1167): Attempting to map URI '/jk-status' from 1 maps
[Mon Jan 09 14:15:58.963 2023] [31374:139970214833088] [debug] find_match::jk_uri_worker_map.c (977): Attempting to map context URI '/jk-status/*=jk-status' source 'JkMount'
[Mon Jan 09 14:15:58.963 2023] [31374:139970214833088] [debug] jk_map_to_storage::mod_jk.c (4074): no match for /jk-status found

all apache files, workers.properties, httpd-jk.conf have chown set to www:data (apache's user).

I've reached a point in which I can access any file in the document root except the one named "jk-status". I want to think it's because the connector is trying something which looks like progress at least.

What am I missing, is my understanding of connectors correct? is this what I need in my case.

Thank you.

I try to configure jk connector to redirect some apache requests' to tomcat

I understood your webapp is accessible under http://www.example.com:8080/spring_app/api/myendpoint and now you would like it to be accessible under http://www.example.com/spring_app/api/myendpoint also.

Here is what you need to do, based on what you already have.

First, configure your VirtualHost to let mod_jk take care of all requests intended for your webapp.

<VirtualHost *:80>
  ...
  # Let the worker named 'ajp13_worker' handle all requests
  # with a path beginning with '/spring_app/' 
  JkMount /spring_app/* ajp13_worker
  ...
</VirtualHost>

Second, define the worker with that name in your workers.properties.

worker.list=ajp13_worker
worker.ajp13_worker.port=8009
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13

Note the difference to your version, the type in particular. What you want is ajp13 . What you used, status , is a special type of worker designed for obtaining status information about mod_jk itself. (The port and host must match the Connector configuration in Tomcat's server.xml , of course, but 8009 and localhost are enabled by default.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM