nginx projects in subfolders

Since your projects aren't actually in the same root, you must use multiple locations for this.

location /wiki {
    root /var/www/wiki/public;
}

location ~ /wiki/.+\.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_param  SCRIPT_FILENAME /var/www/wiki/public$fastcgi_script_name;
}

location /blog {
    root /var/www/blog/public;
}

location ~ /blog/.+\.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_param  SCRIPT_FILENAME /var/www/blog/public$fastcgi_script_name;
}

Also, put fastcgi_index in your fastcgi_params file and include it at server level, that way you keep your php locations as small as possible.


Solves by location+alias:


location / {
   root /var/www/public;
   index index.php;
}
location /blog/ {
   alias /var/www/blog/public/;
   index index.php;
}
location /wiki/ {
   alias /var/www/wiki/public/;
   index index.php;
}

location ~ \.php$ {
   #your fastcgi configuration here 
}