{"id":2984,"date":"2018-12-19T18:17:15","date_gmt":"2018-12-19T10:17:15","guid":{"rendered":"https:\/\/www.ookangzheng.com\/?p=2984"},"modified":"2020-05-24T15:58:36","modified_gmt":"2020-05-24T07:58:36","slug":"debian-install-php-and-caddy-for-pi-hole","status":"publish","type":"post","link":"https:\/\/www.ookangzheng.com\/debian-install-php-and-caddy-for-pi-hole\/","title":{"rendered":"Debian install PHP and Caddy for Pi-hole"},"content":{"rendered":"\n
Server environment<\/strong> Updated Oct 25, 2019<\/p>\n\n\n\n Photo by Kobu Agency<\/a> on Unsplash<\/a><\/p>\n\n\n\n References<\/p>\n\n\n\n Server environment1. Debian10 Buster sid Updated Oct 25, 2019 Install PHP 7.4 PPA Install PHP7.4 Install Caddy Config a site…<\/p>\n","protected":false},"author":1,"featured_media":2987,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,32],"tags":[],"class_list":["post-2984","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-technology"],"_links":{"self":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/2984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/comments?post=2984"}],"version-history":[{"count":0,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/2984\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/media\/2987"}],"wp:attachment":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/media?parent=2984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/categories?post=2984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/tags?post=2984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
1. Debian10 Buster sid<\/p>\n\n\n\nInstall PHP 7.4 PPA<\/h2>\n\n\n\n
sudo apt -y install lsb-release apt-transport-https ca-certificates \nsudo wget -O \/etc\/apt\/trusted.gpg.d\/php.gpg https:\/\/packages.sury.org\/php\/apt.gpg\necho \"deb https:\/\/packages.sury.org\/php\/ $(lsb_release -sc) main\" | sudo tee \/etc\/apt\/sources.list.d\/php.list<\/code><\/pre>\n\n\n\n
Install PHP7.4<\/h2>\n\n\n\n
\/\/ apt install \napt-get -y install curl php7.4-cli php7.4-fpm php7.4-mysql php7.4-curl php7.4-gd php7.4-intl php-pear php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-mbstring php-gettext\n<\/code><\/pre>\n\n\n\n
Install Caddy<\/h2>\n\n\n\n
curl https:\/\/getcaddy.com | bash -s personal\n\/\/ Caddy binary file will store at\n\/usr\/local\/bin\/caddy\n\n\/\/ Change permission\nsudo chown root:root \/usr\/local\/bin\/caddy \n\/\/ permissions \nsudo chmod 755 \/usr\/local\/bin\/caddy<\/code><\/pre>\n\n\n\n
Config a site with PHP<\/h2>\n\n\n\n
\/\/ Edit Caddy file\nnano \/etc\/caddy\/CaddyFile\n\nhttps:\/\/xx.com:81 {\n root \/var\/www\/html\/admin\n log \/var\/log\/caddy\/pihole.review.log \n errors \/var\/log\/caddy\/errors.log\n #basicauth \/ admin password\n tls \/etc\/letsencrypt\/live\/xx.com\/fullchain.pem \/etc\/letsencrypt\/live\/xx.com\/privkey.pem\n gzip\n\t\n fastcgi \/ \/var\/run\/php\/php7.0-fpm.sock php {\n ext .php\n split .php\n index index.php\n }\n rewrite {\n\t\tto {path} {path}\/ \/index.php?page={uri_escaped}\n }\n}<\/code><\/pre>\n\n\n\n