我试图在nginx上创建一个服务器,在同一个子域labs.rasouza.com.br/cdm
,labs.rasouza.com.br/app2
,labs.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
用户拥有所有内容
我做错了什么?