Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Debian 8 (Jessie) with Caddy & PHP 7.0 from scratch
# 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 -O /dev/stdout | bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
apt-get update
apt-get remove apache2 -y
apt-get install dialog -y
apt-get upgrade -y
apt-get install git curl wget software-properties-common nano zip unzip curl dstat screen fail2ban -y
echo 'deb jessie all' > /etc/apt/sources.list.d/dotdeb.list
echo 'deb-src jessie all' >> /etc/apt/sources.list.d/dotdeb.list
apt-key add dotdeb.gpg
rm -f dotdeb.gpg
apt-get update
apt install php7.0-curl php7.0-intl php7.0-fpm php7.0-mysql php7.0-sqlite php7.0-redis php7.0-mcrypt php7.0-mbstring php7.0-xml -y
wget -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 | bash -s ratelimit
setcap cap_net_bind_service=+ep /usr/local/bin/caddy
#rm -f /etc/php/7.0/fpm/pool.d/www.conf
#wget -O /etc/php/7.0/fpm/pool.d/www.conf
# Please manually edit www.conf to run as caddy/caddy
service php7.0-fpm restart
#systemctl daemon-reload
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