Skip to content

Instantly share code, notes, and snippets.

@stigtsp
Forked from Nixtren/debian_8_caddy.sh
Last active April 4, 2017 21:07
Show Gist options
  • Save stigtsp/00dd22ab2e483c56d0a265fc5f4003e5 to your computer and use it in GitHub Desktop.
Save stigtsp/00dd22ab2e483c56d0a265fc5f4003e5 to your computer and use it in GitHub Desktop.
Debian 8 (Jessie) with Caddy & PHP 7.0 from scratch
#!/bin/bash
# This is my personal recipe to put a Caddy webserver running on Debian 8 (Jessie) from scratch.
# This installs some unrelated stuff as well, such as fail2ban, dstat... Feel free to modify it to your needs.
# Run: wget https://gist.githubusercontent.com/Nixtren/ae34d0308355884b9c7431ecab699eb4/raw -O /dev/stdout | bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get install dialog -y
apt-get upgrade -y
apt-get install git curl wget software-properties-common zip unzip curl dstat screen fail2ban -y
wget https://gist.github.com/Nixtren/9421edc3cf980b022428961a3f157086/raw/7dfa93c3ce8c7941b7d4e2a611b0d652e499cd92/caddy.service -O /etc/systemd/system/caddy.service
adduser --disabled-password --quiet --gecos "" caddy
su - caddy -c "touch ~/Caddyfile"
su - caddy -c "mkdir ~/logs"
su - caddy -c "mkdir ~/domains"
curl https://getcaddy.com | bash -s ratelimit
setcap cap_net_bind_service=+ep /usr/local/bin/caddy
systemctl enable caddy
service caddy start
echo "Done, don't forget to configure Caddyfile!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment