Created
February 7, 2017 16:52
-
-
Save regardfs/4cd6970c799305c29f1b4bd2f0938654 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
# create self-signed server certificate: | |
read -p "Enter your domain [www.example.com]: " DOMAIN | |
echo "Create server key..." | |
openssl genrsa -out $DOMAIN.key 2048 | |
echo "Create server certificate signing request..." | |
SUBJECT="/C=US/ST=Mars/L=iTranswarp/O=iTranswarp/OU=iTranswarp/CN=$DOMAIN" | |
openssl req -new -subj $SUBJECT -key $DOMAIN.key -out $DOMAIN.csr | |
echo "Sign SSL certificate..." | |
openssl x509 -req -days 3650 -in $DOMAIN.csr -signkey $DOMAIN.key -out $DOMAIN.crt | |
echo "TODO:" | |
echo "Copy $DOMAIN.crt to /etc/nginx/ssl/$DOMAIN.crt" | |
echo "Copy $DOMAIN.key to /etc/nginx/ssl/$DOMAIN.key" | |
echo "Add configuration in nginx:" | |
echo "server {" | |
echo " ..." | |
echo " listen 443 ssl;" | |
echo " ssl_certificate /etc/nginx/ssl/$DOMAIN.crt;" | |
echo " ssl_certificate_key /etc/nginx/ssl/$DOMAIN.key;" | |
echo "}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment