Skip to content

Instantly share code, notes, and snippets.

@gnh1201
Forked from ccschmitz/install-ssl-apache.md
Created April 10, 2020 01:12
Show Gist options
  • Save gnh1201/672d04e917fec347e7351e21c34da987 to your computer and use it in GitHub Desktop.
Save gnh1201/672d04e917fec347e7351e21c34da987 to your computer and use it in GitHub Desktop.
How to install an SSL certificate on an Apache server.

Installing an SSL certificate on Apache

  1. Create a private key:
openssl genrsa 2048 > private-key.pem
  1. Create a Certificate Signing Request (CSR):
openssl req -new -key private-key.pem -out csr.pem
  1. When you get a response with your certificate, you'll need upload them to your server:
scp ./STAR_yourdomain_com/* yourdomain:/home/ubuntu/cert/new-cert

Note: This assumes there is a yourdomain alias in your ~/.ssh/config.

  1. Then you'll need to concatenate all the files to create your SSL bundle:
cat STAR_yourdomain_com.crt COMODORSAOrganizationValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crt
  1. Configure Apache to work with the new files you created:
<VirtualHost *:443>
  ServerName *.yourdomain.com
  SSLEngine on

  SSLCertificateFile /home/ubuntu/cert/STAR_yourdomain_com.crt
  SSLCertificateKeyFile /home/ubuntu/cert/private-key.pem
  SSLCertificateChainFile /home/ubuntu/cert/ssl-bundle.crt
  SSLCACertificateFile /home/ubuntu/cert/AddTrustExternalCARoot.crt
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment