abiosoft / caddy-docker

Docker container for Caddy
https://hub.docker.com/r/abiosoft/caddy/
MIT License
768 stars 315 forks source link

handle a php www-user instead of nobody #158

Closed stockmind closed 5 years ago

stockmind commented 5 years ago

add a www-user and config it on php-fpm to let php permissions works as expected. The build args PUID and PGUID are useful to bind the www-user id with an host user id.

This will avoid writing and reading permissions error from php and will let a better management of the php user permissions

abiosoft commented 5 years ago

Thanks for this. Have you verified that there are no permission issues for php-fpm to read files on mounted volumes?

stockmind commented 5 years ago

I use this configuration on my production server to let Lumen works correctly for reading and writing logs and other files, the host folder owner user (that is not root) and www-user are configured with same id so everything works as expected. Otherwise, you need to assign "nobody" user every time on the folder and files you want to write... this change prevents loose permissions on those folders and files to get everything working

Without this there were no way to write on the Lumen logs folder if it was owned by the host user other than open it with 777 (bad) or changing the group or user to the same id of the nobody docker server instance (this breaks syncs with ssh or ftp as you need to fix every time the owner)

abiosoft commented 5 years ago

Gotcha, I've confirmed what you said.

screenshot from 2019-01-03 16-53-22