I am converting a legacy Apache server to Nginx and do not have the luxury of changing URL's or rearranging the filesystem.
Is it possible to use nested location{} blocks in the Nginx configuration to tell it to feed the .php files in an aliased directory to fastcgi while serving static content normally?
Similar configuration to what fails me:
server {
listen 80;
location / {
index index.html;
}
location /foosite/ {
alias /var/aliases/foo;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
}
Requests for /foosite/static.jpg are served fine, but nginx appears to garble the path to any .php files when attempting to dispatch them to fastcgi.