0

I have 1 apache server and two tomcat servers with two different applications. I want to use the apache as a proxy so that the user can access the application from the same url using different paths.

e.g.:
localhost/app1 --> localhost:8080/app1
localhost/app2 --> localhost:8181/app2

I tried all 3 mod proxy of apache (mod_jk, mod_proxy_http and mod_proxy_ajp) but the first application is working, whilst the second is not accessible.

This is the apache configuration I'm using:

ProxyPassMatch ^(/.*\.gif)$ !
ProxyPassMatch ^(/.*\.css)$ !
ProxyPassMatch ^(/.*\.png)$ !
ProxyPassMatch ^(/.*\.js)$ !
ProxyPassMatch ^(/.*\.jpeg)$ !
ProxyPassMatch ^(/.*\.jpg)$ !   
ProxyRequests Off
ProxyPass       /app1 ajp://localhost:8009/
ProxyPassReverse    /app1 ajp://localhost:8009/
ProxyPass       /app2 ajp://localhost:8909/
ProxyPassReverse    /app2 ajp://localhost:8909/

With the above, I manage to view the tomcat root application using localhost/app1, but I get "Service Temporarily Unavailable" (apache error) when accessing app2.

I need to keep the tomcat servers separate because I need to restart one of the applications often and it is not an option to save both apps on the same tomcat.

Can someone point me out what I'm doing wrong?

Thank you all.

Sebb77
  • 2,431
  • 2
  • 17
  • 18
  • Is the second tomcat server running / do you have the right port number? Normally you get a 503 when nothing's listening behind the proxy... – arco444 Jun 13 '14 at 15:26
  • The tomcat does not seem to be started or listening to the correct port. Could you add the output of netstat -ano ? – Cédric Couralet Jun 13 '14 at 18:08
  • Both Tomcat servers are running because i can access them using the normal tomcat port. I'm suspecting that ajp is not working properly on the second server. I changed the port to 8909, but it doesn't seem to work because I get the same error when running only this server. Is there somewhere else where I need to change ajp port apart the server.xml? – Sebb77 Jun 13 '14 at 21:29
  • Can you post relevant server.xml part – KNOWARTH Aug 12 '14 at 14:16

0 Answers0