403 Laravel项目的禁止nginx错误

时间:2015-11-07 16:07:33

标签: php laravel nginx

我继承了一个具有以下目录结构的Laravel项目。我相信这是一个Laravel 4.0项目,看到根目录中有app/storage而不是/storage,如Laravel 5.0项目

drwxrwx---  19 loop  staff    646 Nov  7 10:50 .
drwxr-xr-x   8 loop  staff    272 Nov  7 10:07 ..
-rwxrwx---@  1 loop  staff   8196 Nov  7 10:49 .DS_Store
-rw-r--r--   1 loop  staff    323 Nov  7 10:44 .env
-rwxrwx---   1 loop  staff    373 Jun 11 18:24 .htaccess
drwxr-xr-x   9 loop  staff    306 Nov  7 10:42 .idea
drwxrwx---  14 loop  staff    476 Nov  7 10:20 app
-rwxrwx---   1 loop  staff   2452 Nov  9  2014 artisan
drwxrwx---   8 loop  staff    272 Nov  7 10:06 bootstrap
-rwxrwx---   1 loop  staff   1189 Jul  8 13:33 composer.json
-rwxrwx---   1 loop  staff  66700 Jul  3 23:34 composer.lock
drwxrwx---   6 loop  staff    204 Nov  7 10:20 documentation
-rwxrwxrwx   1 loop  staff   1580 Jun 10 14:53 index.php
-rwxrwx---   1 loop  staff    567 Nov  9  2014 phpunit.xml
drwxrwxr-x   7 loop  staff    238 Nov  7 10:50 public
-rwxrwx---   1 loop  staff   2051 Nov  9  2014 readme.md
-rwxrwx---   1 loop  staff    519 Nov  9  2014 server.php
drwxrwx---   4 loop  staff    136 Nov  7 10:06 up-files
drwxrwx---  24 loop  staff    816 Jul  3 23:34 vendor

这是我的Homestead.yaml文件:

sites:             
    // other project mappings                                                              
    - map: clear.app                                                      
      to: /home/vagrant/Code/zfiles/public 

重新加载我的流浪汉条款后,我的页面上遇到以下错误:

enter image description here

所以我继续检查/var/log/nginx/clear.app

下的错误日志
2015/11/07 15:49:56 [crit] 794#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.10.1, server: clear.app, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "clear.app"

2015/11/07 15:57:51 [error] 794#0: *8 directory index of "/home/vagrant/Code/zfiles/public/" is forbidden, client: 192.168.10.1, server: clear.app, request: "GET / HTTP/1.1", host: "clear.app"

我继续为755更改了文件目录权限,例如app/storage。我还检查了我的nginx配置,这是以下内容:

listen 80;
server_name clear.app;
root "/home/vagrant/Code/zfiles/public";

index index.html index.htm index.php;

charset utf-8;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

我在StackOverflow和ServerFault上尝试了很多“修复”,但没有运气。

1 个答案:

答案 0 :(得分:0)

nginx用户是否有权访问公共目录?