I think I have a trivial problem with nginx but I can't see it.
I have the following file tree:
/data/www
> main/
>> html/
>>>...some files (A)
> wiki/
>>...some files (B)
Here is my config:
server {
listen 80;
server_name troll;
root /data/www/main/html;
location = / {
index index.php;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/main/html$fastcgi_script_name;
}
location /wiki/ {
root /data/www/wiki;
rewrite ^/wiki(.*)$ $1 break;
}
location ~ ^/wiki/(.*)\.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/wiki/$fastcgi_script_name;
}
}
So, I expect to open files (A) on / urls and (B) files on /wiki urls.
But I have a 403 error on /wiki:
2013/02/12 23:25:06 [error] 30567#0: *58 directory index of "/data/www/wiki/" is forbidden, client: ..., server: ..., request: "GET /wiki/ HTTP/1.1", host: "..."
Even if they have the same rights:
drwxrwx--- 18 apache apache 4096 févr. 10 10:35 /data/www/main/html
drwxrwx--- 8 apache apache 4096 déc. 10 2010 /data/www/wiki
and
-rw-r--r-- 1 apache apache 6366 févr. 8 15:10 /data/www/ifaedi/html/index.php
-rw-r--r-- 1 apache apache 185 déc. 10 2010 /data/www/wiki/index.php
If you have any idea...
Edit:
I tried the following configuration:
location /wiki/ {
root /data/www;
index index.php;
}
location ~ ^/wiki/(.*)\.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/$fastcgi_script_name;
}
I have no longer a 403 but php-fpm gives me a "File not found."
2013/02/13 13:06:55 [error] 3876#0: *5 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: ..., server: ..., request: "GET /wiki/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "..."