LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2013, 01:58 AM   #1
mlnm
Member
 
Registered: Jun 2011
Posts: 96

Rep: Reputation: Disabled
Unable to redirect tomcat to apache using mod_jk


Hi , i am trying to redirect my java project webapp in tomcat to apache using mod_jk.

1.I installed mod_jk 1.2.37

2.Created a workers.properties file in /etc/httpd/conf
worker.list= ajp
worker.ajp.type=ajp13
worker.ajp.port=8009
worker.ajp.host=localhost

3.mod_jk entries in httpd.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

4.Configured virtual host with rewrite rule
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.mydomain.com
RewriteEngine on
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /mywebapp/$1 [L,PT]
JkMount /* ajp
</VirtualHost>

while trying to reach http://mydoamin.com , i get following error:
HTTP Status 404 - /mywebapp/mywebapp/
description The requested resource is not available.


I only have one mywebapp ,but dont know why its showing /mywebapp/mywebapp/

Before adding the virtual host entry ,my http.conf was like this:
LoadModule jk_module modules/mod_jk.so

JkWorkersFile conf/workers.properties

JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /mywebapp* ajp
Then i used to get myweapp with folliwing url:
http://mydomain.com/mywebap/

Details:
Server : RHEL 5.9
Apache: 2.2.3
Tomcat: 7.0.37
mod_jk:1.2.37


I have checked catalina.out , error.log .access.log ,mod_jk.log but nothing significant is found.

Any valid suggestions will be greatly appreciated
Thanks in advance..
 
Old 04-25-2013, 04:46 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,597

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Hi,

If you application is deployed under /mywebapp in tomcat and you want to rewrite a request for / to /mywebapp, so it will be served by tomcat, you need to use:
Code:
RewriteRule ^/$ /mywebapp [PT]
Regards

Last edited by bathory; 04-25-2013 at 04:52 AM. Reason: typos
 
Old 04-25-2013, 05:53 AM   #3
mlnm
Member
 
Registered: Jun 2011
Posts: 96

Original Poster
Rep: Reputation: Disabled
Thank you so much ,my problem has been solved .Actually i was trying to get my url like this:
http://mydomain.com/index.jsp instead of http://mydomain.com/mywebapp/index.jsp so i used RewriteRule ^/(.*)$ /mywebapp/$1 [L,PT].

But this will do anyway.Thanks once again...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Session replication using apache+mod_jk+tomcat(5.5.28-veriosn of tomcat) sreejithp Linux - Server 1 12-24-2010 07:46 AM
Tomcat - server.xml SSL configuration with mod_jk redirect bar338 Linux - Server 3 06-04-2010 12:38 AM
Tomcat 6 / apache 2.2.3 / mod_jk help mikelawford Linux - Server 11 08-20-2009 04:05 PM
Apache/Tomcat/Mod_JK chantman Linux - Software 1 04-05-2006 05:32 AM


All times are GMT -5. The time now is 09:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration