1. Output of caddy version:
v2.6.2
2. How I run Caddy:
Installed following the official guide on the host system itself (not Docker), and uses systmctl (as in the docs) rather than manually calling caddy
a. System environment:
Ubuntu 22.04 LTS
3. The problem I’m having:
Users/Permissions. So this may be more a Linux thing - I’m unsure because I don’t understand how Caddy/PHP “run as a user/group”.
I’ve got everything set up and running just fine with PHP and Caddy when their respective config files (and the filesystem) are using the caddy user and group. As long as I sudo chown -R caddy:caddy /webroot it all runs great. PHP can do things, Caddy can serve things.
The issue is that I have to sudo chown -R caddy:caddy /webroot because the User that actually uses the filesystem (myuser lets say) is the one that’s able to SSH in and use GitHub, but if that user owns the /webroot directory, PHP can’t write to it. Conversely if caddy owns it all, GIT can’t write to it. And I can’t “become the caddy user” (and feel like doing that would be wrong anyway)
5. What I already tried:
- I’ve tried adding
myuserto thecaddygroup. - I’ve tried adding
caddyto themyusergroup. - I’ve tried changing the
/etc/php/8.1/fpm/pool.d/www.conffile so that theuserorgroupandlisten.ownerorlisten.groupbelong tomyuser(in various combinations) - I’ve tried similar with the
/lib/systemd/system/caddy.serviceso the User / Group isn’t justcaddy
I have not been able to find a way to get things so that the myuser account can read and write to the /webroot and still retain PHP/Caddy being able to work.
This feels like something of a 101 setup issue, but I’ve also not been able to find anything relevent in the forum of via some googling.