How to Add Free SSL Certificate from LetsEncrypt via Certbot in your Java Tomcat / Tomee website?

Assumptions:
1. You are using Linux / Debian Server
2. You are using Compute Engine
3. You are using Google Domains
4. Set $JAVA_HOME=<path to your java base directory>
5. Set $CATALINA_BASE=<path to your Tomcat / Tomee base directory>

-------------------------------------------------------------------------------------

Procedure:
2. In selection option, 
    a) My website running on <none of the above>
    b) Operating system using <as per your operating system>, <Debian 10 in my case>
3. Type command sudo apt-get install certbot
4. Type command sudo certbot certonly --standalone
5. Your certificate will be downloaded and installed in /etc/letsencrypt folder

6. Your certificate files are as follows:
/etc/letsencrypt/live/<your domain name>/cert.pem
/etc/letsencrypt/live/<your domain name>/chain.pem
/etc/letsencrypt/live/<your domain name>/fullchain.pem
/etc/letsencrypt/live/<your domain name>/privkey.pem

7. Change permissions of these file if needed as it have default root access only so that Tomcat/ Tomee user can acces them

8. Type command sudo nano $CATALINA_BASE/conf/server.xml

9. Provide following lines in server.xml
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="/etc/letsencrypt/live/<your domain name>/privkey.pem"
                         certificateFile="/etc/letsencrypt/live/<your domain name>/cert.pem"
                         certificateChainFile="/etc/letsencrypt/live/<your domain name>/chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>

10.  // restart tomc(at/ee) server
11. Check your working https:// website in your domain name

Work Done

No comments:

Post a Comment

If you have any doubts, please let me know.

Regarding site Free Browser Tool (https://free-browser-tools.mohitkrgupta.dev) (discussion with google search AI)

Various discussions with Google Search AI regarding site  Free Browser Tool are as below: site free-browser-tools.mohitkrgupta.dev what doe...