Created
September 30, 2022 03:37
-
-
Save twinsant/dd5d2e40505dd8d1b824b2946087dd3e to your computer and use it in GitHub Desktop.
Update nginx ssl
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
| # 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