Rajeev
Rajeev

Reputation: 123

How to use HTTPS on localhost on Tomcat?

I am using Apache Tomcat 8 and also have .cert file and the .key file. But I am unable to understand how to turn on the HTTPS mode. I want the APR implementation which uses OpenSSL by default. I tried to change the server.xml file in conf folder according to the documentation but after that Tomcat failed to start and I have delete it and use new unzipped files to start. How can I turn on SSL?

Upvotes: 4

Views: 12561

Answers (1)

muilpp
muilpp

Reputation: 1343

If the APR is already installed and configured on your Tomcat, you could have something like this in your server.xml:

Connector protocol="org.apache.coyote.http11.Http11AprProtocol"
       port="8443" maxThreads="200"
       scheme="https" secure="true" SSLEnabled="true"
       SSLCertificateFile="/usr/local/ssl/server.crt"
       SSLCertificateKeyFile="/usr/local/ssl/server.pem"
       SSLVerifyClient="optional" SSLProtocol="TLSv1+TLSv1.1+TLSv1.2"/>

Take a look at this tutorial tutorial, it was quite helpful for me.

Also this one could be interesting.

Upvotes: 3

Related Questions