Last active
August 29, 2015 13:58
-
-
Save notbrain/10025587 to your computer and use it in GitHub Desktop.
Script to create a self signed certificate with an existing server key. Single argument is FQDN of app.
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
#!/bin/sh | |
APP_NAME=$1 | |
APPSSLPATH=/usr/local/etc/nginx/ssl/$APP_NAME; | |
sudo mkdir -p $APPSSLPATH && cd $APPSSLPATH; | |
# sudo /usr/bin/openssl req -new -key $KEY_FILEPATH -out $APPSSLPATH/$APP_NAME.csr && \ | |
sudo openssl req -new -newkey rsa:2048 -nodes -out $APP_NAME.csr -keyout $APP_NAME.key -subj "/C=US/ST=California/L=San Francisco/O=Engineering Inc./CN=$APP_NAME" && \ | |
sudo /usr/bin/openssl x509 -req -days 1365 -in $APP_NAME.csr -signkey $APP_NAME.key -out $APP_NAME.crt; | |
echo "--" | |
echo "Use the following lines in nginx config:" | |
echo | |
echo "ssl_certificate_key $APPSSLPATH/$APP_NAME.key;" | |
echo "ssl_certificate $APPSSLPATH/$APP_NAME.crt;" | |
echo | |
echo "--" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: