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; } }