LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 12: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, 03:46 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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 03:52 AM. Reason: typos
 
Old 04-25-2013, 04: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



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 06:46 AM
Tomcat - server.xml SSL configuration with mod_jk redirect bar338 Linux - Server 3 06-03-2010 11:38 PM
Tomcat 6 / apache 2.2.3 / mod_jk help mikelawford Linux - Server 11 08-20-2009 03:05 PM
Apache/Tomcat/Mod_JK chantman Linux - Software 1 04-05-2006 04:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:03 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
Open Source Consulting | Domain Registration