Skip to content

Instantly share code, notes, and snippets.

@codycraven
Created August 7, 2017 23:32
Show Gist options
  • Save codycraven/bba48dcdcd87a9df4e2bb87834b5a65d to your computer and use it in GitHub Desktop.
Save codycraven/bba48dcdcd87a9df4e2bb87834b5a65d to your computer and use it in GitHub Desktop.
#!/bin/bash
curl -s https://getcaddy.com | bash
which caddy
sleep 5
sudo mkdir /etc/caddy
sudo chown -R root:www-data /etc/caddy
sudo touch /etc/caddy/Caddyfile
sudo mkdir /etc/ssl/caddy
sudo chown -R www-data:root /etc/ssl/caddy
sudo chmod 0770 /etc/ssl/caddy
# Setup /var/www dir to work like Nginx/Apache
sudo mkdir /var/www
sudo chown www-data:www-data /var/www
# Setup Caddy as a service
sudo curl -s https://raw.githubusercontent.com/mholt/caddy/master/dist/init/linux-systemd/caddy.service -o /etc/systemd/system/caddy.service
sudo systemctl daemon-reload
sudo systemctl enable caddy.service
sudo systemctl status caddy.service
sleep 5
# Open firewall
sudo ufw allow http
sudo ufw allow https
echo ""
# Next steps
echo "Caddy install complete"
echo "Edit /etc/caddy/Caddyfile to configure your web server"
echo "When complete, run: sudo systemctl start caddy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment