AJP Connector Apache-Tomcat with php and java application

Posted by Safari on Server Fault See other posts from Server Fault or by Safari
Published on 2013-11-05T15:23:50Z Indexed on 2013/11/05 15:57 UTC
Read the original article Hit count: 235

Filed under:
|
|

I have a question about proxy and ajp module.

On my machine I have a Apache web server and a Tomcat servlet container.

On Tomcat is running a my java webapplication.

On Apache I have some services and I can call these in this way:

http://myhos/service1
http://myhos/service2
http://myhos/service3

I would configurate a ajp connector to call my tomcat webapplication from Apache. I would somethin as http://myhost to call the Tomcat webapp.

So, I configurated my apache in this way..and I have what I wanted: I can use http://myHost to visualize the Tomcat webApp by Apache.

<VirtualHost *:80>

    ProxyRequests off
    ProxyPreserveHost On

    ServerAlias myserveralias
    ErrorLog logs/error.log
    CustomLog logs/access.log common

    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

     ProxyPass /server-status !
     ProxyPass /balancer-manager !

    ProxyPass / balancer://mycluster/ stickysession=JSESSIONID nofailover=Off maxattempts=1

    <Proxy balancer://mycluster>
       BalancerMember ajp://myIp:8009  min=10 max=100 route=portale loadfactor=1
       ProxySet lbmethod=bytraffic
    </Proxy>

    <Location /balancer-manager>
        SetHandler balancer-manager
        Order deny,allow
        Allow from localhost
    </Location>


    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent

</VirtualHost>

But, now I can't use the apache services:

If I use http://myhos/service1 I have an error because apache try to search service1 on my tomcatWebApp.

Is there a way to fix it?

© Server Fault or respective owner

Related posts about apache2

Related posts about tomcat