简体   繁体   English

NGINX + PHP5-FPM + DEPLOY - 文件权限

[英]NGINX + PHP5-FPM + DEPLOY - file permissions

I have server with Nginx , PHP5-FPM .我有NginxPHP5-FPM 的服务器。

I'm running 1 process in fpm pool with this configuration:我正在使用以下配置在 fpm 池中运行 1 个进程:

user = php-site
group = www-site

listen = /var/run/php5-fpm_web.sock

listen.owner = php-site
listen.group = www-site
listen.mode = 0666

I have these users: - www-site (groups: www-site) - php-site (groups: www-site) - deploy (groups: deploy, www-site)我有这些用户: - www-site (groups: www-site) - php-site (groups: www-site) - deploy (groups: deploy, www-site)

This deploy user has only SSH access to do some stuff (composer, git deploy, etc..).这个部署用户只有 SSH 访问权限来做一些事情(composer、git deploy 等)。

Problem is here, my application creates cache files in cache folder.问题在这里,我的应用程序在缓存文件夹中创建缓存文件。 Cache folder has 0775 (deploy:www-site), but cache/template/file.cache has 0644 (php-site:www-site).缓存文件夹中有0775(部署:WWW站点),但缓存/模板/ file.cache0644(PHP的网站:WWW站点)。 When I want to purge this cache folder, over rm -rf cache/* , I'm receiving Permission denied .当我想通过rm -rf cache/*清除此缓存文件夹时,我收到Permission denied


How could I solve it?我怎么能解决呢? If php5-fpm would create files with mask 0666 everything gonna be alright.如果 php5-fpm 会创建掩码为0666 的文件,一切都会好起来的。

Possible ways to do that:可能的方法:

1) Add umask to your base PHP scrip ( index.php ) 1) 将 umask 添加到您的基本 PHP 脚本 ( index.php )

2) Add umask to your php5-fpm profile, to master process or single pool 2) 将 umask 添加到您的php5-fpm配置文件,以主进程或单个池

3) Add umask to your unix user, user that php5-fpm or nginx runs ( http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html ) 3)将umask添加到您的unix用户,php5-fpm或nginx运行的用户( http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM