-
-
Save edpichler/d7daa0c26b18dca6dc49f65f8d51274c to your computer and use it in GitHub Desktop.
Create a self-signed SSL certificate for Nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Generating an SSL private key to sign your certificate..." | |
openssl genrsa -des3 -out private.key 1024 | |
echo "Generating a Certificate Signing Request..." | |
openssl req -new -key private.key -out myssl.csr | |
echo "Removing passphrase from key (for nginx)..." | |
cp private.key private.key.old | |
openssl rsa -in private.key.old -out private.key | |
rm private.key.old | |
echo "Generating certificate..." | |
openssl x509 -req -days 36500 -in myssl.csr -signkey private.key -out self-signed-public.crt | |
echo "Copying certificate (myssl.crt) to /etc/ssl/certs/" | |
mkdir -p /etc/ssl/certs | |
cp self-signed-public.crt /etc/ssl/certs/ | |
echo "Copying key (myssl.key) to /etc/ssl/private/" | |
mkdir -p /etc/ssl/private | |
cp private.key /etc/ssl/private/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment