LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 06-01-2010, 04:08 PM   #1
bar338
LQ Newbie
 
Registered: Nov 2009
Posts: 8

Rep: Reputation: 0
Tomcat - server.xml SSL configuration with mod_jk redirect


I have an application that is currently setup to redirect from port 8080 to port 8009. This then uses the mod_jk connector to redirect it to port 80 so that the application is viewable as if it was running on apache.

I've recently purchased an SSL certificate and am having difficulty configuring tomcat to redirect properly.

Below is my current configuration:

server.xml
Quote:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8080" acceptCount="100" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="UTF-8"
scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="NEWkeystore"
keystorePass="password" />


<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" UIEncoding="UTF-8" tomcatAuthentication="false"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

<Host name="www.mydomain.org" appBase="/path/to/directory"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="application" debug="0" reloadable="true"/>
</Host>
worker.properties
Quote:
workers.tomcat_home=/usr/share/tomcat6
workers.java_home=/usr/java/jdk1.6.0_16
ps=/
worker.list=worker1
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=worker1
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)
i386$(ps)classic$(ps)libjvm.so
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stder
mod_jk
Quote:
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send requests for context /application to worker named worker1
JkMount /application/* worker1

# Rewrite rule in case
RewriteRule ^/(application/.+);jsessionid=\w+$ /$1
After all this when I try to visit the url:
https://www.mydomain.com/application

I get the error:
Forbidden
You don't have permission to access /e-resources/ on this server.

Any suggestions on what I can do to get this working? Your help is greatly appreciated.
 
Old 06-02-2010, 12:47 AM   #2
zanerock
LQ Newbie
 
Registered: May 2010
Location: Austin, TX
Distribution: openSUSE
Posts: 8

Rep: Reputation: 0
A couple things I'm not getting here.

First:

'redirectPort' is the port where Tomcat sends requests for resources that should be secure, but are not using HTTPS. E.g., someone requests 'login.jsp' which is configured to require SSL. If the request is non-secure, it will be redirected to the secure port. Usually you set 'redirectPort' on a non-secure connector. I'm guessing it has no effect to set it on a secure connector.


Second:

If apache involved, it usually handles the incoming request and the SSL and hands off to tomcat for processing. Apache is much better at handling the SSL itself and I've never seen handling the SSL at the Tomcat level when Apache is already involved. You may have your reasons, but wanted to make sure this is really what you want to do.


I'll be glad to help out if I can once I understand your goal a bit better.


Z
 
Old 06-02-2010, 02:54 PM   #3
bar338
LQ Newbie
 
Registered: Nov 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Basically I had my website setup so that the application running on tomcat could be reached by :
http://mydomain.com/application
instead of mydomain.com:8080/application

In addition to this I have several other applications running directly off of apache. When I upgraded to SSL for apache it was as simple as configuring the SSL and changing the URL to https. So the SSL is handled on apache, I just need to figure out how to get tomcat to cooperate with this.

With https I get a 403 Forbidden error or a 404 page not found error. I then use the same URL and change it to http and it once again works.

My goal is to be able to use the https protocol with my tomcat application.

Does that make sense?
 
Old 06-03-2010, 11:38 PM   #4
zanerock
LQ Newbie
 
Registered: May 2010
Location: Austin, TX
Distribution: openSUSE
Posts: 8

Rep: Reputation: 0
If apache is handling the SSL, there's no need for tomcat to be SSL aware, just configure Tomcat to listen on 8009.
 
  


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
Tomcat 6.0 on Linux, after modifying tomcat-users.xml still cannot login. cuian01 Linux - Newbie 1 01-28-2010 03:45 AM
Apache2, Tomcat 6 and mod_jk ziggy25 Linux - Software 1 09-13-2009 03:07 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
mod_jk-2.0.42.so - apache-tomcat connector anura Linux - Software 0 10-11-2004 03:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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