我的nginx php-fm网络服务器能够提供有权限000的网页.为什么?

前端之家收集整理的这篇文章主要介绍了我的nginx php-fm网络服务器能够提供有权限000的网页.为什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

也许我错过了一些非常基本的东西,但是我的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服务器以受限制的访问权限提供新文件.

原文链接:https://www.f2er.com/nginx/434782.html

猜你在找的Nginx相关文章