Algoritim Bilişim
FAYDALILINKLER

Guide to Installing SSL on Apache and Tomcat with ZeroSSL

Guide to Installing SSL on Apache and Tomcat with ZeroSSL

Guide to Installing SSL on Apache and Tomcat with ZeroSSL

In today's digital landscape, having an SSL certificate for websites is critical, not only for security but also for SEO performance. In this guide, we will walk you through the process of setting up an SSL certificate obtained through ZeroSSL on Apache and Tomcat servers step by step.

Generating Certificates from ZeroSSL

Firstly, you need to sign up and log in to the ZeroSSL website. Visit https://app.zerossl.com to do so. Follow these steps once logged in:

  • Click the New Certificate button on the Dashboard.
  • Enter your domain name without 'www' in the 'Enter Domain' field. If your domain contains non-English characters, like Turkish characters, you should convert it using Punycode Converters. Use sites like https://www.punycoder.com/ for this purpose.
  • In the next step, you can choose the free 90-day option or opt for the paid 1-year version.
  • Under the "CSR & Contact" section, continue with "Auto Generate CSR" selected.
  • Click "Next Step" in the "Finalize Your Order" section.
  • During the "Verify Domain" step, prove your domain ownership using a method of your choice. For Apache, the "HTTP File Upload" option can be handy. For Tomcat, other methods might be more convenient.
  • After clicking "Verify Domain", you'll proceed to the "Install Certificate" section.
  • From here, you can download SSL certificate files tailored to your server type, whether it's the default format, Apache, or others. We will select Apache for this guide. Note that even if you also want to set it up for Tomcat, you don't need to download files specifically for Tomcat. The instructions below will cover how to deploy the files to both systems.

Installing SSL for Apache

  1. Transfer Certificate Files: Move the SSL certificate files you received from your provider to the /etc/ssl directory. The private key should be placed in the private sub-directory of the same directory.

    • /etc/ssl/ca_bundle.crt
    • /etc/ssl/certificate.crt
    • /etc/ssl/private/private.key
  2. Edit Apache Settings: Modify the default-ssl.conf file of Apache:

    nano /etc/apache2/sites-available/default-ssl.conf
    

    Make the following additions or changes to the file:

    ServerName yourdomain.com
    SSLCertificateFile /etc/ssl/certificate.crt
    SSLCertificateKeyFile /etc/ssl/private/private.key
    SSLCertificateChainFile /etc/ssl/ca_bundle.crt
    
  3. Enable SSL Mode:

    sudo a2enmod ssl
    
  4. Activate SSL Site:

    sudo a2ensite default-ssl
    
  5. Restart Apache:

    systemctl reload apache2
    
  6. Verification: Use the command below to verify:

    apachectl -t -D DUMP_VHOSTS
    

    If the output shows port 443, it indicates the setup has been completed successfully.

Installing SSL for Tomcat

  1. Merging Certificate and CA Bundle:

    cat certificate.crt ca_bundle.crt > mybundle.crt
    
  2. Certificate Conversions:

    openssl pkcs12 -export -out yourdomain.com.pfx -inkey private.key -in mybundle.crt -password pass:YourPassword123
    keytool -importkeystore -srckeystore yourdomain.com.pfx -src
    
    storetype pkcs12 -srcalias 1 -srcstorepass YourPassword123 -destkeystore yourdomain.com.jks -deststoretype jks -deststorepass YourPassword123 -destalias yourdomain.com
    
  3. Edit Tomcat Settings: Make the following additions or changes to the server.xml file:

Note: In the example above, the domain used is yourdomain.com. Ensure you replace it with your actual domain.

By following this guide, you can effortlessly set up an SSL certificate on both Apache and Tomcat servers. Not only does SSL enhance the security of your website, but it also plays a crucial role in boosting your position in Google search rankings. Therefore, setting up SSL for your website is of paramount importance.