Skip to content

Instantly share code, notes, and snippets.

@twinsant
Created September 30, 2022 03:37
Show Gist options
  • Select an option

  • Save twinsant/dd5d2e40505dd8d1b824b2946087dd3e to your computer and use it in GitHub Desktop.

Select an option

Save twinsant/dd5d2e40505dd8d1b824b2946087dd3e to your computer and use it in GitHub Desktop.
Update nginx ssl
# Check argument
if [ -z $1 ]; then
echo Need a domain name.
exit 1
fi
# Move and unzip
downlaodfile=~/Downloads/$1_nginx.zip
zipfile=$1_nginx.zip
crtfile=$1_bundle.crt
keyfile=$1.key
if [ -f "$downlaodfile" ]; then
mv $downlaodfile ./
fi
unzip $zipfile -d ~/ssl/
# Scp
pkdir=$1_nginx
bundle=./$pkdir/$crtfile
key=./$pkdir/$keyfile
ls -l $bundle $key
scp $bundle $key root@<YOUR HOST>:/etc/nginx/
# Reload nginx
ssh -t root@<YOUR HOST> 'ls -l /etc/nginx/'
ssh -t root@<YOUR HOST> 'nginx -s reload'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment