NGINX configuration. PHP frameworks with PATHINFO 404
I'd prefer to use the following nginx config structure. It's cleaner:
location / { try_files $uri $uri/ @phpsite;}location @phpsite { include fastcgi_params; ... other fast_cgi directives}
A bit more complex setup can be found in the popular silex project: http://silex.sensiolabs.org/doc/web_servers.html#nginx.
I see 2 problems in the original config file:
location ~ \.php$ { try_files $uri =404; ...}
- In regex '$' means matching at the end of the string. So it failed as stated in the comments by prodigitalson.
- That try_files directive inside the above fast_cgi location block should not be there because that location block is supposed to be handled by php alone. It's cleaner to remove that line.
I think what you're missing is a rule like
location / { try_files $uri $uri/ /index.php?$args;}
that will try to call that index.php url if the path does not exist.
Or maybe, if you know that it is pointless to try other things, just
location / { try_files /index.php?$args;}
or
location ~ /index.php { try_files /index.php?$args;}
This works for me...
location ~ ^(.*?\.php)($|/.+) { try_files $1 =404; ... fastcgi conf...}