i have a mass virutal hosting setup on my server everything works fine, just that i am not able to get subdirectory index working
example
www.domain.com works fine
www.domain.com/folder/ doesnt work shows 404 error
www.domain.com/folder/index.php works fine
below is my default config used
Thanks
server {
listen 80;
server_name ~^[^.]+\.[^.]+$; # domain.com
rewrite ^ http://www.$host$request_uri?;
}
server {
listen 80 default;
server_name ~^(.*)\.(.*\..*)$;
server_name_in_redirect off;
set $docroot /var/www/$2/httpdocs/$1/;
root $docroot;
access_log off;
error_log /var/log/nginx/error.log error;
#static files serving with expire headers
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ {
if ( -e $request_filename){
expires max;
break;
}
}
# Deny important files
location ~* ^.+.(log|logs|sql)$ {
deny all;
}
location ~ /\. {
deny all;
}
location ~* ^/(var|plugins|etc|lib|cache|api) {
deny all;
}
location / {
root $docroot;
index index.php index.html;
if (!-e $request_filename) {
rewrite ^/latest-links/.htm[l]?$ /index.php?list=latest last;
rewrite ^/top-hits/.htm[l]?$ /index.php?list=top last;
rewrite ^/latest-articles/.htm[l]?$ /index.php?list=latestarticles last;
rewrite ^/(.*)detail/link-(.*)\.htm[l]?$ /detail.php last;
rewrite ^/(.*)articles/article-(.*)/.htm[l]?$ /article.php last;
rewrite ^/(.*)authors/author-(.*)\.htm[l]?$ /author.php last;
rewrite ^/(.*)page-[0-9]+\.html$ /index.php last;
rewrite ^/(.+)\.html$ /page.php?name=$1 last;
rewrite ^/(.*)$ /index.php last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $docroot$fastcgi_script_name;
include fastcgi_params;
}
# Error Pages
error_page 404 /404.html;
location = /404.html {
root /var/www/nginx-default;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/nginx-default;
}
}