Skip to content

Instantly share code, notes, and snippets.

@sageworksstudio
Last active June 1, 2020 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sageworksstudio/f77021cd638bb9baeee7d9defc8de294 to your computer and use it in GitHub Desktop.
Save sageworksstudio/f77021cd638bb9baeee7d9defc8de294 to your computer and use it in GitHub Desktop.
SSL - Creating CSR, keys and storing certificates for Apache2

SSL (HTTPS) - Creating CSR, keys and storing certificates

More info

Apache


Create a new folder to store certs and keys:

sudo mkdir /etc/apache2/ssl

Generate the CSR and Key files:

sudo openssl req -new -newkey rsa:2048 -nodes -keyout /etc/apache2/ssl/mydomain.key -out /etc/apache2/ssl/mydomain.csr

Use the CSR to request new SSL certificate files.

Place the new certificate files inside /etc/apache2/ssl

Give ownership of the directory and files to root:

sudo chown -R root:root /etc/apache2/ssl

Change the permissions of the certs/bundle/key files to 400

Then set the folder permissions to 500

NOTE: When the files are up for renewal you will need to change the write permissions on the ssl folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment