Created
October 9, 2019 01:33
-
-
Save mkrupczak3/74ee47c6f5cc19a81469308f95dd5906 to your computer and use it in GitHub Desktop.
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 | |
# | |
# startup.sh | |
# | |
# Startup the nginx server. The server has to be active for the Let's Encrypt Certbot to | |
# register and install the certificates. | |
nginx -g "daemon on;" | |
# Checks that the SSL certificates are installed. If they are, renews any that are old, and | |
# installs them if not. | |
if [[ -d "/etc/letsencrypt/live/matthew.krupczak.org" ]]; then | |
if ! [[ -f "/etc/ssl/certs/dhparam.pem" ]]; then | |
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 | |
fi | |
certbot renew --quiet | |
else | |
if ! [[ -f "/etc/ssl/certs/dhparam.pem" ]]; then | |
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 | |
fi | |
if ! [[ -d "/etc/letsencrypt/live/matthew.krupczak.org" ]]; then | |
certbot --nginx -m matthew@krupczak.org --agree-tos --no-eff-email --redirect --expand -d matthew.krupczak.org | |
fi | |
fi | |
# Shuts down the daemonized nginx server and fires up one in the foreground. | |
nginx -s stop && nginx -g 'daemon off;' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment