Manual for full install Caddy Server with php7.0-fpm on Ubuntu/Debian

https://oonlab.com/code/2016/08/12/setup-caddy-on-ubuntu-to-work-with-php/

Sorry if that spam.

1 Like

Hi, neat little guide. Couple thoughts - firstly, your website is serving a certificate for github… As for the guide itself:

Installation

  • Might be a good idea to put a warning here about piping curl to bash. getcaddy.com won’t pwn your system (at the moment) but the people reading your guide might think it’s OK to pipe curl to bash in general, which is widely regarded as bad practice

Site configuration

  • Second line has a typo, is missing the directory, and doesn’t need -R (recursive) flag, it should probably read sudo chown www-data:www-data /opt/www

Caddy configuration

  • Not much point setting /etc/ssl/caddy to the root group, since root can read/write everything anyway - just set it to www-data:www-data
  • There’s also no need to chown -R that directory because it’s empty, you only just made it
  • So instead of sudo chown -R www-data:root /etc/ssl/caddy, just use sudo chown www-data:www-data /etc/ssl/caddy
  • Permissions for the certificates folder should probably be 700; you can just use sudo chmod 700 /etc/ssl/caddy for this
  • Caddyfile could use some indenting in the brackets :slight_smile:
  • tls your@yourdomain.com.com , some of us aren’t lucky enough to own the com.com domain :slight_smile:
  • Your fastcgi directive could be simplified to fastcgi / /var/run/php/php7.0-fpm.sock php, see the fastcgi docs for the php preset / examples

Testing PHP

  • No need for -r flag in sudo rm -r /opt/www/tes.php, you’re only removing one file
3 Likes

Dave, you should incorporate Matthews suggestions to improve your page…!

I don’t know about older versions, but in Ubuntu 16.04 the packages php5-fpm and php5-cli curl don’t exist.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.