也许我错过了一些非常基本的东西,但是我的Web服务器如何能够执行并提供拥有许可000的php文件中的内容?
这是有问题的文件:http://178.62.125.162/test.php
位置是:
/usr/share/nginx/html/wordpress/test.php
这是ls:
---------- 1 deploy deploy 21 May 22 09:40 test.php
nginx.conf有一行:
user www-data;
所以它不是以root用户身份运行的.
ps aux | grep [n]ginx
root 30223 0.0 0.1 85876 1364 ? Ss May21 0:00 nginx: master process /usr/sbin/nginx
www-data 30224 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process
www-data 30225 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process
www-data 30226 0.0 0.2 86516 2732 ? S May21 0:00 nginx: worker process
www-data 30227 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process
看起来很正常,AFAIK是以root身份运行的主进程.
和php-fm:
ps aux | grep php
root 30311 0.0 1.8 309068 18580 ? Ss May21 0:02 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 30314 0.0 3.5 393324 36176 ? S May21 0:01 php-fpm: pool www
www-data 30315 0.0 3.1 388956 32112 ? S May21 0:01 php-fpm: pool www
www-data 30391 0.0 2.9 389828 29528 ? S May21 0:00 php-fpm: pool www
我甚至无法打开文件,以deploy身份登录:
cat test.php
cat: test.php: Permission denied
php test.php
Could not open input file: test.php
谷歌无处不在,但我发现的大多数事情都与相反的人有关 – 人们得到了禁止的错误.
也许是因为它在/usr/share?谢谢!
额外信息:
Ubuntu x64 LTS
PHP-FM
更新:
更改权限后重新启动php-fm服务会修复它.但这对我没有意义:
chmod 000 test.php - web echos "test"
service php5-fm restart - Access Denied
chmod 644 test.php - web echos "test". No need for a restart this time?
chmod 000 test.php - web echos "test".
最佳答案
感谢Alexander Ushakov提供的答案.
具有可读权限的文件已由php-fm缓存.重新启动php-fm意味着缓存被清除,然后Web服务器以受限制的访问权限提供新文件.