本文章主要介绍了nginx访问权限问题,具有不错的的参考价值,希望对您有所帮助,如解说有误或未考虑完全的地方,请您留言指出,谢谢!
1、问题
server { listen 8011; server_name test.cn; location ~ /.php?.*$ { root /home/zhj/; #fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
2021/02/25 16:04:48 [error] 44148#0: *1 open() "/home/zhj/zhj.php" failed (13: Permission denied), client: 192.168.132.1,
server: test.cn, request: "GET /zhj.php HTTP/1.1", host: "192.168.132.89:8011"
2、问题解决
因为Linux系统内置限制普通用户权限分隔,因为nginx无法访问放在普通用户目录下的程序包。
将程序包在非普通账户下即可
server { listen 8011; server_name test.cn; location ~ /.php?.*$ { root /home/; #fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
原创文章,作者:bd101bd101,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/228368.html