Created
June 10, 2024 02:29
-
-
Save timlrx/8ef12d793896f388815ee7946de349c3 to your computer and use it in GitHub Desktop.
Shell script to install caddy
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 | |
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl | |
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg | |
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list | |
sudo apt update | |
sudo apt install caddy | |
# Create a Caddyfile for reverse proxy | |
sudo tee /etc/caddy/Caddyfile > /dev/null <<EOF | |
yourdomain.com { | |
reverse_proxy localhost:7860 | |
} | |
EOF | |
# Verify service is running | |
# systemctl status caddy | |
# Reload Caddy to apply the new configuration | |
sudo systemctl reload caddy | |
# Enable Caddy to start on boot | |
sudo systemctl enable caddy | |
echo "Caddy has been installed and configured to reverse proxy to your app on port 7860." | |
echo "Please ensure that DNS for your subdomain is correctly set to point to this server." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment