Vishwesh Shetty
Vishwesh Shetty

Reputation: 727

Use same SSL certificate for Tomcat on port 80 and Apache on 8080

I have got a SSL certificate for domain "www.example.com" and I have installed this certificate in tomcat server which runs on port 80 which runs fine. Now my requirement is to run php code in https since my Apache is running on 8080 how do I make https:// work on port 8080. Is it even possible? I tried installing same certificate in Apache (Editing SSL.conf file to point to my certificate.). I even converted tomcat keystore to apache key file. But I think I need mod_ssl which is not installed in my server and I am not even able to install it (Reconfigure Apache with mod_ssl).

To summarize my questions :

  1. Is it possible to install SSL certificate on server running on port 8080.
  2. Is it possible to use same certificate generated from tomcat keystore in Apache
  3. What is the easiest way to do this?
  4. How to reconfigure Apache with mod_ssl if installing SSL certificates requires that. (This maybe a dumb question -> Under which folder do I run ./configure --enable-ssl... type of command)

My basic requirement is to run both PHP and JSP codes through https.

Upvotes: 1

Views: 7093

Answers (2)

rightstuff
rightstuff

Reputation: 6532

The simpler way to do this is to use Apache as the front-end, and use its ProxyPass capabilities (the opposite of your setup).

Have Apache run on port 80 and 443 (SSL), and Proxy requests for specific websites and/or URLs to Tomcat running on 127.0.0.1:8080.

It's simpler because to set this up in Apache, all you need is to add one line...

ProxyPass /foo http://127.0.0.1:8080/foo

So when a request comes in for https://www.example.com/foo, Apache get's /foo from Tomcat, and transparently passes back to you... And everything is SSLed as far as the user is concerned.

If you don't want to do this...

1) Is it possible to install SSL certificate on server running on port 8080.

Yes. Port numbers are not hardcoded to anything. Just enable SSL in that Tomcat Connector.

2) Is it possible to use same certificate generated from tomcat keystore in Apache.

It should be. Certificates are domain-based. They don't care about what type of server uses them... BUT they do need to be in the right format. You might need to re-format the key and cert.

Upvotes: 4

Related Questions