-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
10 additions
and
15 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
|
||
#!/bin/bash | ||
|
||
yum update -y | ||
yum install -y nginx certbot python3-certbot-nginx | ||
sudo yum update -y | ||
sudo yum install -y nginx certbot python3-certbot-nginx | ||
|
||
# Create nginx config | ||
tee /etc/nginx/nginx.conf <<EOF | ||
sudo tee /etc/nginx/nginx.conf <<EOF | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
@@ -52,16 +52,11 @@ http { | |
EOF | ||
|
||
# Obtain SSL certificate | ||
certbot --nginx -d ${certbot_domains} --non-interactive --agree-tos -m [email protected] | ||
sudo certbot --nginx -d ${certbot_domains} --non-interactive --agree-tos -m [email protected] | ||
|
||
# Ensure Certbot auto-renewal is enabled | ||
systemctl enable certbot.timer | ||
systemctl start certbot.timer | ||
sudo systemctl enable certbot.timer | ||
sudo systemctl start certbot.timer | ||
|
||
# Restart NGINX to apply changes | ||
if systemctl is-active --quiet nginx; then | ||
systemctl reload nginx | ||
else | ||
systemctl start nginx | ||
systemctl enable nginx | ||
fi | ||
sudo systemctl restart nginx |
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