LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 05-01-2011, 12:57 PM   #1
Felipe
Member
 
Registered: Oct 2006
Posts: 294

Rep: Reputation: 31
How to connect Apache to Tomcat?


Hallo:

I'm configuring a web server using Apache and Tomcat. I use Apache 2 and various instances of Tomcat5 and Tomcat6.
I try that Apache serves the static data and tomcat the dynamic (Apache receives all requests, sending tomcat only the dynamic)

I see that Apache and Tomcat can be connected using http or ajp Can any tell me:
- What connector should I use: ajp, http,...?
- How can I say Apache to serve the static data and Tomcat the dynamic?
Due to I have many instances of Tomcat, connectins http and https, https with client certificates, and due to the port configuration:
- Is there any way to configure Apache-tomcat without the use of ports in tomcat (a differect connector)?

An easy sample would be appreciated.

Thanks

Last edited by Felipe; 05-01-2011 at 01:10 PM.
 
Old 05-01-2011, 07:19 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
I use mod_jk (ajp) to connect Apache and Tomcat. I made changes to the Apache httpd.conf file (you probably won't need the same set and there are others):
Code:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile "/usr/local/apache2/conf/extra/workers.properties"
JkLogFile "/var/log/httpd/mod_jk.log"
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T
The workers.properties file contains this:
Code:
worker.list=ajp13
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
worker.ajp13.lbfactor=50
worker.ajp13.cachesize=10
worker.ajp13.cache_timeout=600
worker.ajp13.socket_keepalive=1
worker.ajp13.socket_timeout=300
To direct URLs I use this in the virtual hosts section:
Code:
  JkMount /timesheets ajp13
  JkMount /timesheets/* ajp13
  JkMount /timesheetadmin ajp13
  JkMount /timesheetadmin/* ajp13
  JkMount /testingdb ajp13
  JkMount /testingdb/* ajp13
This info is from an old backup (I'm not at work at the moment) and I can't recall why I have the top directory as well as the wildcard, but google may help.
 
1 members found this post helpful.
Old 05-02-2011, 02:21 AM   #3
Felipe
Member
 
Registered: Oct 2006
Posts: 294

Original Poster
Rep: Reputation: 31
Thank you for the information.
It's detailed and I'll look for some of the parameters.

The only question I can't see is how to say Apache to serve static data and Tomcat de dynamic.
Do I have to mount it on Apache and Tomcat? How do I do it?

Thanks
 
Old 05-02-2011, 03:14 AM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 162Reputation: 162
You can put the static URLs in <Directory>, <Location> tags, etc. and the dynamic content is referenced with the JkMount directives.
 
  


Reply

Tags
apache2, tomcat


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
[SOLVED] How to run Apache on one server and connect to Tomcat on another? Subject16 Linux - Software 3 01-03-2011 02:53 PM
mod_jk or mod_proxy to connect apache to tomcat exceed1 Linux - Server 1 05-30-2009 04:27 PM
Apache 2.2.0 and Apache-Tomcat 5.5.17, how can i connect them? Ukitake Fedora 1 06-04-2006 09:25 AM
How to connect Tomcat 5 and Apache 2.0.48 using mod_jk2 zhangwf Linux - Networking 1 03-20-2004 09:42 AM
How to connect Tomcat 5 and Apache 2.0.48 using mod_jk2 zhangwf Linux - Newbie 0 03-19-2004 09:21 PM


All times are GMT -5. The time now is 07:34 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration