Skip to content

Instantly share code, notes, and snippets.

@dot-mike
Forked from abhishek77in/caddy_ec2_ubuntu22_04.sh
Last active July 5, 2024 23:25
Show Gist options
  • Save dot-mike/e617dd3bfc8da4077d031f037bf9e48e to your computer and use it in GitHub Desktop.
Save dot-mike/e617dd3bfc8da4077d031f037bf9e48e to your computer and use it in GitHub Desktop.
Script to install caddy
#!/bin/bash
sudo apt update
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
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
sudo tee /etc/caddy/Caddyfile > /dev/null <<EOF
yourdomain.com {
reverse_proxy localhost:7860
}
EOF
caddy version
sudo systemctl status caddy
sudo systemctl enable caddy
sudo systemctl restart caddy
sudo systemctl reload caddy
sudo ufw allow proto tcp from any to any port 80,443
sudo ufw status
sudo ufw enable
sudo ufw app list
sudo ufw allow 22/tcp
sudo ufw show added
ufw default allow outgoing
ufw default deny incoming
ufw logging on low
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment