Debian install PHP and Caddy for Pi-hole

Server environment
1. Debian9 sid

Updated May 12, 2019

Install PHP 7.3 PPA

sudo apt -y install lsb-release apt-transport-https ca-certificates 
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg
echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list

Install PHP7.3 

// apt install 
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 | bash -s personal
// Caddy binary file will store at

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

Config a site with PHP

// Edit Caddy file
nano /etc/caddy/CaddyFile {
    root /var/www/html/admin
    log /var/log/caddy/ 
    errors /var/log/caddy/errors.log
    #basicauth / admin password
    tls /etc/letsencrypt/live/ /etc/letsencrypt/live/
    fastcgi / /var/run/php/php7.0-fpm.sock php {
        ext .php
        split .php
        index index.php
    rewrite {
		to {path} {path}/ /index.php?page={uri_escaped}

Photo by Kobu Agency on Unsplash