Why is that and how can I fix the problem from the first block?
In nginx, one request is handled in one location.
http://nginx.org/r/location describes the rules, so that you can know
which one location will be used for a particular request.
In the above location{} blocks, you give no indication of what nginx
should do with the request, so it uses its default of “serve it from
the filesystem”.
The difference between your two observations is that in the first case,
the location{} block is used for the request that you made; and in the
second case, the location{} block is not used.
To fix your configuration, you must put all of the configuration that
you want to apply to a request, in the one location{} that handles
that request.
$document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
But that is redundancy and can be complicated if you have many of those
entries and then want to change a .php setting (you have to do it
multiple
times).
Isn’t it possible to make it simpler?
On Sun, Jul 21, 2013 at 01:08:18PM -0400, Peleke wrote:
Hi there,
Okay, it works if I add this:
location ^~ /folder1/admin {
> location ~ \.php$ {
> }
> }
location ~ \.php$ {
> }
But that is redundancy and can be complicated if you have many of those
entries and then want to change a .php setting (you have to do it multiple
times).
Isn’t it possible to make it simpler?
Yes.
Either use an external-to-nginx thing to create the complicated config
file from less complicated parts; or put the repeated parts in a file
and
“include” it.