Author |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Mon 12 Jul '10 11:59 Post subject: mod_jk |
|
|
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
|
Posted: Tue 20 Jul '10 13:20 Post subject: |
|
|
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
|
Posted: Wed 21 Jul '10 14:12 Post subject: |
|
|
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
|
Posted: Wed 21 Jul '10 15:26 Post subject: |
|
|
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
|
Posted: Thu 22 Jul '10 15:54 Post subject: |
|
|
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
|
Posted: Thu 22 Jul '10 20:47 Post subject: |
|
|
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
|
Posted: Tue 27 Jul '10 9:52 Post subject: |
|
|
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
|
Posted: Tue 27 Jul '10 16:04 Post subject: |
|
|
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
|
Posted: Wed 28 Jul '10 14:25 Post subject: |
|
|
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
|
|
Back to top |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Thu 29 Jul '10 12:25 Post subject: |
|
|
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
|
Posted: Thu 29 Jul '10 13:05 Post subject: |
|
|
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
|
Posted: Thu 29 Jul '10 15:50 Post subject: |
|
|
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
|
Posted: Thu 06 Jan '11 20:42 Post subject: mod_jk |
|
|
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 |
|