简体   繁体   English

Nginx php7.4 权限被拒绝

[英]Nginx php7.4 permission denied

I have stacked with permission denied on my php site.我在我的 php 网站上堆放了被拒绝的权限。 I have tried lot of different configuration but no luck.我尝试了很多不同的配置,但没有运气。 I am using nginx 1.16, php 7.4 centos.我正在使用 nginx 1.16、php 7.4 centos。 Right now I have disable SELinux and rest configuration:现在我已经禁用 SELinux 和 rest 配置:

Nginx runs with user nginx. Nginx 与用户 nginx 一起运行。

Site permissions folders have 775 permissions and files 664. For both of these owner is my user and group is nginx.站点权限文件夹有 775 个权限和 664 个文件。这两个所有者都是我的用户,组是 nginx。

Php-fpm: user: myuser, group: nginx, owneruser: nginx, ownergroup: nginx, mode: 0660 php-fpm:用户:myuser,组:nginx,所有者用户:nginx,所有者组:nginx,模式:0660

I am trying to access a simple test.php file that echoes "hello".我正在尝试访问一个简单的 test.php 文件,该文件回显“hello”。

My browser shows a white screen with 404 error and the log files show permission denied.我的浏览器显示带有 404 错误的白屏,并且日志文件显示权限被拒绝。

UPDATE更新

I tested with a test.html page and still got permission denied so I guess it is not something with php but something with nginx.我用 test.html 页面进行了测试,但仍然被拒绝许可,所以我猜这不是 php 而是 nginx 的问题。

Below are excerpts from access and error.log accordingly:以下是 access 和 error.log 的摘录:

Access log excerpt:访问日志摘录:

176.92.20.33 - - [17/Dec/2020:06:56:32 +0200] "GET /test.html HTTP/1.1" 404 153 "-" "Mozilla/5.0 (Android 10; Mobile; rv:84.0) Gecko/84.0 Firefox/84.0" "-"

Error Log excerpt:错误日志摘录:

2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxx/www/test.html" failed (13: Permission denied), client: 176.92.20.33, server: acropolismuseumkids.gr, request: "GET /test.html HTTP/1.1", host: "xxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/index.php" failed (13: Permission denied), client: 176.92.20.33, server: xxxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/404.html" failed (13: Permission denied), client: 176.92.20.33, server: xxxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/404.html" failed (13: Permission denied), client: 176.92.20.33, server: xxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxxx"
2020/12/17 06:56:32 [crit] 1152#0: *3 stat() "/home/xxxxx/www/index.php" failed (13: Permission denied), client: 176.92.20.33, server: xxxxx, request: "GET /test.html HTTP/1.1", host: "xxxxx"

Any help is appreciated.任何帮助表示赞赏。

Well It seems I had made a studipd mistake.好吧,看来我犯了一个愚蠢的错误。 I has misstyped the cgi gateway on nginx and php-fpm configuration files.我在 nginx 和 php-fpm 配置文件上打错了 cgi 网关。 These two should be the same.这两个应该是一样的。

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

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