I'm configuring a pretty standard webserver using nginx. The server is working as expected, however, there is a small configuration detail I would like to understand.
My current configuration is:
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
With this configuration, if I access to: http://myweb.com/wp-content/uploads/2012/10/cropped-bitmap11.png/lol.php I get a 404 as expected.
However, with this configuration:
try_files $uri =404;
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
I get a blank page with "Access denied".
Why is the result different?
Thank you