Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have Apache setup as my web server, and Tomcat is hooked into Apache via mod_jk, so the user never interacts with Tomcat.

I have set up SSL on Apache, and I can hit it with https://localhost, but when I try to access my application at https://localhost/app, I get a directory not found error.

The catch is when I go regular http, I can hit it fine: http://localhost/app

What do I have to edit for this connection to work?

  • I have uncommented the AJP connector in server.xml
  • I have added my virtual host to httpd.conf

What am I missing?

share|improve this question

6 Answers 6

Look at this article. It explains exactly how to do mod_jk with https. It is accomplished via a secure virtual host which then communicates to Tomcat on the same standard AJP channel you use with non secure connection.

http://kahimyang.info/kauswagan/howto_blogs/1464-2_ways_to_setup_ssl_on_tomcat_7

share|improve this answer

The http and https are considered different virtual servers by Apache. Did you set up your reverse proxy under both virtual hosts?

share|improve this answer

If you use mod_jk, you need the AJP connector in Tomcat.

In most cases, if the worker has a configuration problem, Apache will answer with a 500 error (Server error). If you get a 404, this is rather because the request does not get passed to the Tomcat server (or the URL is invalid from Tomcat point of view). Check that the JkMount is present and correct in your Apache configuration (for the 443 port).

To debug problems with mod_jk, turn on the debug logs in mod_jk and look at Apache logs. Add these lines in mod_jk configuration (jk.conf in general):

JkLogFile /var/log/apache2/mod_jk.log

JkLogLevel debug

You should see some logs at startup and some interesting details for each request.

I did this kind of setup for Apache2 + SSL + JBoss. You will find other details and optimisation tips in Deploying a J2EE application behind an Apache server in a production environment

share|improve this answer

It should work if configured correctly. Just another thing to check - that your proxy pass rules are accessible within the SSL connection. It is possible to configure the SSL version of a website to be different from the non-SSL version. Make sure that your proxy pass configuration is sitting in both.

share|improve this answer

Your definition for workers could be wrong. Check workers.properties for work's type. If ajp13, unconmment your ajp section in tomcat back as it was. mod_jk usually uses ajp13 as type.

share|improve this answer

you need to replicate the setup you have from http to https - you don't need the ajp connector if you have a http connector

look how it is setup - probably it does a proxy pass or uses a RewriteRule with the P at the end which is a proxy.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.