也许我遗漏了一些非常基本的东西,但我的网络服务器如何能够执行和提供权限为 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
在我看来很正常,据我所知主进程以 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
我什至无法自己打开文件,以部署身份登录:
cat test.php
cat: test.php: Permission denied
php test.php
Could not open input file: test.php
Google 无处不在,但我发现的大多数事情都与相反的事情有关——人们得到禁止的错误。
也许是因为它在/usr/share 中?谢谢!
额外信息:
Ubuntu x64 长期支持
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 服务器以受限的访问权限提供新文件。
关于php - 我的 nginx + php-fm 网络服务器能够为具有权限 000 的网页提供服务。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30392786/