-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct escaping of variables in ssl_manager.sh to fix ShellCheck war…
…nings
- Loading branch information
1 parent
4653d06
commit 0658dff
Showing
1 changed file
with
6 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,26 +15,26 @@ setup_ssl() { | |
|
||
# Configure Nginx for domain | ||
echo -e "\n⚙️ Configuring Nginx for $domain..." | ||
ssh "$admin_user@$server_ip" "sudo bash -c 'cat > /etc/nginx/sites-available/\$domain << EOF | ||
ssh "$admin_user@$server_ip" "sudo bash -c 'cat > /etc/nginx/sites-available/\\$domain << EOF | ||
server { | ||
listen 80; | ||
server_name \$domain www.\$domain; | ||
server_name \\\$domain www.\\\$domain; | ||
location / { | ||
proxy_pass http://localhost:8000; | ||
proxy_set_header Host \$host; | ||
proxy_set_header X-Real-IP \$remote_addr; | ||
proxy_set_header Host \\\$host; | ||
proxy_set_header X-Real-IP \\\$remote_addr; | ||
} | ||
} | ||
EOF'" | ||
|
||
# Enable site | ||
ssh "$admin_user@$server_ip" "sudo ln -sf /etc/nginx/sites-available/\$domain /etc/nginx/sites-enabled/" | ||
ssh "$admin_user@$server_ip" "sudo ln -sf /etc/nginx/sites-available/\\$domain /etc/nginx/sites-enabled/" | ||
ssh "$admin_user@$server_ip" "sudo nginx -t && sudo systemctl reload nginx" | ||
|
||
# Get SSL certificate | ||
echo -e "\n🔑 Obtaining SSL certificate..." | ||
ssh "$admin_user@$server_ip" "sudo certbot --nginx -d \$domain -d www.\$domain --non-interactive --agree-tos --email [email protected]" | ||
ssh "$admin_user@$server_ip" "sudo certbot --nginx -d \\\$domain -d www.\\\$domain --non-interactive --agree-tos --email [email protected]" | ||
|
||
# Setup auto-renewal cron job | ||
echo -e "\n⏰ Setting up automatic renewal..." | ||
|