logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: mod_jk
Author
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Mon 12 Jul '10 11:59    Post subject: mod_jk Reply with quote

Hello

I would like to point my main page (on Apache) to app hosted on JBoss AS called myapp. Now i'm using mod_rewrite which rewrites all reqests to main page by adding myapp on the end of the address. After this mod_jk forward this request to application server.

Is there any way to point main page to this alias without mod_rewrite or to map f.x. myhost.com/aaa to /bbb application in application server ?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 20 Jul '10 13:20    Post subject: Reply with quote

For that you could use apache as reverse proxy e.g.

Code:

<Location /examples/>
   ProxyPass ajp://localhost:8009/examples/
</Location>


or

Code:

<Location /examples/>
ProxyPass http://localhost:8080/examples/
ProxyPassReverse http://localhost:8080/examples/
</Location>
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Wed 21 Jul '10 14:12    Post subject: Reply with quote

James Blond wrote:
For that you could use apache as reverse proxy e.g.

Code:

<Location /examples/>
   ProxyPass ajp://localhost:8009/examples/
</Location>


or

Code:

<Location /examples/>
ProxyPass http://localhost:8080/examples/
ProxyPassReverse http://localhost:8080/examples/
</Location>


This is not i'm looking for couse of two reasons :

- this is not mod_jk module but mod_proxy
- i need to point apache alias to different application name than alias name f.x. apache : mydomain.com/xxx/example ---> tomcat : tomcat_host/example
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 21 Jul '10 15:26    Post subject: Reply with quote

Qmpeltaty wrote:

- this is not mod_jk module but mod_proxy


The first example with ajp:// uses mod_jk


Qmpeltaty wrote:

i need to point apache alias to different application name than alias name

The location must not exist on apache document root, so it can be used like an alias.

So in your example case

Code:

# inside the vhost
<Location /xxx/example>
   ProxyPass ajp://tomcat_host:8009/example
</Location>


It might help if you post your mod_jk setup

edit ---------
Using the a reverse proxy is the right way to bind tomcat into apache see http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Thu 22 Jul '10 15:54    Post subject: Reply with quote

James Blond wrote:
Qmpeltaty wrote:

- this is not mod_jk module but mod_proxy


The first example with ajp:// uses mod_jk



I'm sure that you must be mistaken - ProxyPass is not mod_jk directive.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 22 Jul '10 20:47    Post subject: Reply with quote

Yes you are right. The reverse proxy is not mod_jk, but it uses the same protocol AJP. AJP is the reason why using mod_jk, cause it is a binary protocol and faster than http.

Ok back to your problem. You can use JKMount for that

JkMount <URL prefix> <Worker name>

So
Code:

<Location /xxx/example>
JkMount  /examples/*.jsp worker1
</Location>

#maybe
<Location /xxx/example/>
JkMount  /examples/*.jsp worker1
</Location>

or it might work without the location container.
I can't try cause I don't have mod_jk
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Tue 27 Jul '10 9:52    Post subject: Reply with quote

James Blond wrote:

So
Code:

<Location /xxx/example>
JkMount  /examples/*.jsp worker1
</Location>

#maybe
<Location /xxx/example/>
JkMount  /examples/*.jsp worker1
</Location>

or it might work without the location container.
I can't try cause I don't have mod_jk


Unfortunately such configuration is not possible. I got this error with your config :

Code:

JkMount can not have a path when defined in a location


So the proper configuration with Location directive is :

Code:

<Location /xxx/example/>
JkMount worker
</Location>


which means that Location path = application name. In that case my problem is still on board.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 27 Jul '10 16:04    Post subject: Reply with quote

A solution might be vhost in the server.xml with a dummy domainname.
Than put in {Tomcat}/conf/Catalina/{domain.de}/ a xml ROOT with the fitting context. Than you can mount /
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Wed 28 Jul '10 14:25    Post subject: Reply with quote

James Blond wrote:
A solution might be vhost in the server.xml with a dummy domainname.
Than put in {Tomcat}/conf/Catalina/{domain.de}/ a xml ROOT with the fitting context. Than you can mount /


I'm using JBoss with Tomcat bundled.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 28 Jul '10 17:40    Post subject: Reply with quote

Also in jboss it is possible to do that. See

So you have

http://fruit.mycompany.com:8080/quince
http://fruit.mycompany.com:8080/pineapple
http://fruit.mycompany.com:8080/lime

and want

http://quince.mycompany.com
http://pineapple.mycompany.com
http://lime.mycompany.com

so than

Modify tomcat's server.xml to list your servers
Code:

<Engine name="Catalina" defaultHost="quince">
    <Host name="quince"    appBase="quince_apps"/>
    <Host name="pineapple" appBase="pineapple_apps"/>
    <Host name="lime"      appBase="lime_apps"/>
</Engine>


move each application to 'ROOT' folder of corresponding "_apps" folder.

http://stackoverflow.com/questions/1506451/how-to-direct-subdomains-to-the-correct-jboss-app ( 3rd answer)
and
http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch9.chapt.html
and
http://www.skillipedia.com/howto.hm?rid=125
and
http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch07.html
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Thu 29 Jul '10 12:25    Post subject: Reply with quote

James Blond wrote:
Also in jboss it is possible to do that. See

So you have

http://fruit.mycompany.com:8080/quince
http://fruit.mycompany.com:8080/pineapple
http://fruit.mycompany.com:8080/lime

and want

http://quince.mycompany.com
http://pineapple.mycompany.com
http://lime.mycompany.com

so than

Modify tomcat's server.xml to list your servers
Code:

<Engine name="Catalina" defaultHost="quince">
    <Host name="quince"    appBase="quince_apps"/>
    <Host name="pineapple" appBase="pineapple_apps"/>
    <Host name="lime"      appBase="lime_apps"/>
</Engine>


move each application to 'ROOT' folder of corresponding "_apps" folder.

http://stackoverflow.com/questions/1506451/how-to-direct-subdomains-to-the-correct-jboss-app ( 3rd answer)
and
http://docs.jboss.org/jbossas/jboss4guide/r4/html/ch9.chapt.html
and
http://www.skillipedia.com/howto.hm?rid=125
and
http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch07.html


What i need is to point 3 different aliases to exactly the same application (let's call it XXX) so :

mydomain.com/en/xxx/
mydomain.com/dk/xxx/
mydomain.com/pl/xxx/

I don't want to run 3 instances of same application (to many issues to solve will be involved then) but this config you gave me require to do so.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 29 Jul '10 13:05    Post subject: Reply with quote

So I think rewrite would be the easiest solution for you even if you don't like it...
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Thu 29 Jul '10 15:50    Post subject: Reply with quote

James Blond wrote:
So I think rewrite would be the easiest solution for you even if you don't like it...


This is http request behavior i want to accomplish :

Scenario 1:

1. User from USA requesting my page by www.mydomain.com
2. Apache based on mod_geoip checks his IP address (based on this information user's request is gonna to be rewritten)
3. Mod_rewrite rewrites user request to www.mydomain.com/us/xxx (xxx my app name)
4. Mod_jk will point this request to application server (jboss/xxx)
5. Application will recognize that site should be shown in english

Scenario 2:

1. User from Canada requesting my page by www.mydomain.com
2. Apache based on mod_geoip checks his IP address (based on this information user's request is gonna to be rewritten)
3. Mod_rewrite rewrites user request to www.mydomain.com/can/xxx (xxx my app name)
4. Mod_jk will point this request to application server (jboss/xxx)
5. Application will recognize that site should be shown in english

Scenario 3:

1. User from Germany requesting my page by www.mydomain.com
2. Apache based on mod_geoip checks his IP address (based on this information user's request is gonna to be rewritten)
3. Mod_rewrite rewrites user request to www.mydomain.com/ger/xxx (xxx my app name)
4. Mod_jk will point this request to application server (jboss/xxx)
5. Application will recognize that site should be shown in german


Scenario 4:

1. User from France requesting my page by www.mydomain.com
2. Apache based on mod_geoip checks his IP address (based on this information user's request is gonna to be rewritten)
3. Mod_rewrite rewrites user request to www.mydomain.com/fr/xxx (xxx my app name)
4. Mod_jk will point this request to application server (jboss/xxx)
5. Application will recognize that site should be shown in french


Thats why i need to point three different aliases to same application in JBoss.
Back to top
vsinha



Joined: 06 Jan 2011
Posts: 1

PostPosted: Thu 06 Jan '11 20:42    Post subject: mod_jk Reply with quote

Hi All,

how can we configure apache or tomcat-

1. User request to www.mydomain.com/abc/xxx (xxx my app name)

2. Mod_jk will point this request to application server (tomcat/xxx)
Back to top


Reply to topic   Topic: mod_jk View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules