Setting up Caddy with PHP & MySQL Stack on Ubuntu 16.04

By eliminating payment, web server configuration, validation email management and certificate renewal tasks, it is meant to significantly lower the complexity of setting up and maintaining TLS encryption.


Setting Up the Instance

Installing Caddy

Configuring Caddy

mkdir /etc/caddy
chown -R root:root /etc/caddy
mkdir /etc/ssl/caddy
mkdir /var/log/caddy
chown -R root:www-data /etc/ssl/caddy /var/log/caddy
chmod 0770 /etc/ssl/caddy /var/log/caddy
touch /etc/caddy/Caddyfile
chown root:root /etc/caddy/Caddyfile
chmod 644 /etc/caddy/Caddyfile
chown -R www-data:www-data /var/www
chmod -R 555 /var/www {
root /var/www
cp caddy.service /etc/systemd/system/
chown root:root /etc/systemd/system/caddy.service
chmod 644 /etc/systemd/system/caddy.service
systemctl daemon-reload
systemctl start caddy.service
systemctl enable caddy.service

Installing MySQL

Installing PHP7.0 {
root /var/www
log /var/log/caddy/
errors /var/log/caddy/errors.log

fastcgi / /run/php/php7.0-fpm.sock php {
ext .php
split .php
index index.php




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store