403文件权限正确时禁止

时间:2015-08-19 01:53:16

标签: php nginx

我试图在nginx上创建一个服务器,在同一个子域labs.rasouza.com.br/cdmlabs.rasouza.com.br/app2labs.rasouza.com.br/app3等下有多个laravel(一个php框架)网站。

nginx和php已正确配置为以web用户身份运行,我的根文件夹位于/home/web下:

drwxrwxrwx  5 web web 4.0K Aug 18 13:56 cdm
-rwxr-xr-x  1 web web   24 Aug 12 02:53 info.php
drwxr-xr-x 13 web web 4.0K Aug 12 04:15 owncloud
drwxr-xr-x  2 web web 4.0K Aug 18 15:23 tmp

我的网站可用配置如下:

server {
        listen   80;

        root /home/web;
        index index.php index.html index.htm;

        server_name labs.rasouza.com.br;

        access_log /home/web/tmp/labs.access.log;
        error_log /home/web/tmp/labs.error.log;

        location / {
                try_files $uri $uri/ /index.html;
        }

        location ~ ^/cdm/(.+\.php)$ {
                alias /home/web/cdm/current/public/;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                include fastcgi_params;

        }

        # pass the PHP scripts to FastCGI server listening on the php-fpm socket
        location ~ \.php$ {
                try_files $uri $uri/ =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;

        }


}

每当我尝试访问labs.rasouza.com.br/cdm时,我都会看到403 Forbidden页面,错误日志为:directory index of "/home/web/cdm/" is forbidden。当我尝试访问info.php时,它就可以了。文件权限也可以,web用户拥有所有内容

我做错了什么?

0 个答案:

没有答案