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.

 

Sumber: https://serverfault.com/questions/218818/nginx-projects-in-subfolders

Advertisements