Last active
December 10, 2017 21:32
-
-
Save Nixtren/ae34d0308355884b9c7431ecab699eb4 to your computer and use it in GitHub Desktop.
Debian 8 (Jessie) with Caddy & PHP 7.0 from scratch
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 | |
# 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 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 http://packages.dotdeb.org jessie all' > /etc/apt/sources.list.d/dotdeb.list | |
echo 'deb-src http://packages.dotdeb.org jessie all' >> /etc/apt/sources.list.d/dotdeb.list | |
wget https://www.dotdeb.org/dotdeb.gpg | |
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 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 | |
#rm -f /etc/php/7.0/fpm/pool.d/www.conf | |
#wget https://gist.github.com/Nixtren/9421edc3cf980b022428961a3f157086/raw/d28a077b7de08f2c71a17947bdd99338948d64b0/www.conf -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