Skip to content

Instantly share code, notes, and snippets.

@zoonderkins
Last active December 19, 2018 10:23
Show Gist options
  • Save zoonderkins/5013074b26ef17eed14c3eb17ec2df8c to your computer and use it in GitHub Desktop.
Save zoonderkins/5013074b26ef17eed14c3eb17ec2df8c to your computer and use it in GitHub Desktop.
pi-hole using Caddy+PHP7.3+Debian9 #linux

Install Caddy and PHP7.3 on Debian9

apt-get -y install curl php7.3-cli php7.3-fpm php7.3-mysql php7.3-curl php7.3-gd php7.3-intl php-pear php7.3-imap php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl php7.3-mbstring php-gettext

Install Caddy

curl https://getcaddy.com | bash -s personal

// Caddy binary file will store at

/usr/local/bin/caddy

// Change permission
sudo chown root:root /usr/local/bin/caddy 
// permissions 
sudo chmod 755 /usr/local/bin/caddy

Add PHP conf into Caddyfile

xx.com {
    root /var/www
    log /var/log/caddy/xx.com.review.log 
    errors /var/log/caddy/errors.log
    basicauth / admin password
        tls /etc/letsencrypt/live/xx.com/fullchain.pem /etc/letsencrypt/live/xx.com/privkey.pem
        gzip
    fastcgi / /run/php/php7.3-fpm.sock php {
        ext .php
        split .php
        index index.php
     }
}

Add PHP PPA inside Debian9

sudo apt install ca-certificates apt-transport-https 
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment