Nginx的尝​​试和索引权限错误(实际文件工作正常)

我在Mac上通过Homebrew安装了nginx。 我最近试图添加一个虚拟的PHP服务器。 当我访问正确的文件名时,它工作正常,但是当try块被调用或者索引文件应该被提供时,会产生许可错误。

#200 : http://php-sandbox.dev/index.php #404 : http://php-sandbox.dev/index http://php-sandbox.dev/ 

index.php文件存在于根目录的web目录中,与其path中的所有文件夹一样,它具有744个权限。

索引指令显然被忽略。 看下面的例子和错误以及我的nginxconfiguration。

nginx的站点configuration文件:

 server { listen 80; listen [::]:80; error_log /var/log/nginx/php-sandbox/error.log debug; rewrite_log on; server_name php-sandbox.dev; root /Users/sswright/repos/jswright61/php-sandbox/public; index index.php index.html; include drop.conf; #ignores favicons location / { try_files $uri $uri.php $uri/ =404; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } } 

错误日志:(/请求)

 2017/04/23 09:47:15 [crit] 11149#0: *9 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET / HTTP/1.1", host: "php-sandbox.dev" 2017/04/23 09:47:15 [crit] 11149#0: *9 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/.php" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET / HTTP/1.1", host: "php-sandbox.dev" 2017/04/23 09:47:15 [crit] 11149#0: *9 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET / HTTP/1.1", host: "php-sandbox.dev" 

try块正在执行,但索引没有被尝试。

错误日志:(/索引请求)

 2017/04/23 10:11:40 [crit] 11149#0: *12 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/index" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET /index HTTP/1.1", host: "php-sandbox.dev" 2017/04/23 10:11:40 [crit] 11149#0: *12 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/index.php" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET /index HTTP/1.1", host: "php-sandbox.dev" 2017/04/23 10:11:40 [crit] 11149#0: *12 stat() "/Users/sswright/repos/jswright61/php-sandbox/public/index" failed (13: Permission denied), client: 127.0.0.1, server: php-sandbox.dev, request: "GET /index HTTP/1.1", host: "php-sandbox.dev" 

在这里它正在寻找index.php但获取权限错误。 当请求/index.php时,页面正确加载。