Answer the question
In order to leave comments, you need to log in
Why doesn't nginx process the request after finding the index file?
Hello.
There is such a config (nginx + Apache):
location / {
index index.php;
proxy_pass http://ip:8080;
location ~* "^/content/.*\.php$" {
return 404;
}
}
Answer the question
In order to leave comments, you need to log in
The answer is something like this: the index directive works only if nginx is going to give the file from the disk and a folder is found in the current path.
If the current location has a proxy_pass / fastcgi_pass, then nginx doesn't even look for the index file. Accordingly, the second time it does not pass according to the rules and gives control to proxy_pass / fastcgi_pass.
Thanks to Alexey Ten for the answer in the comments to the question.
> Why this happens
Because the request is made to /content/ , not to /content/index.php.
This means that the request processing remains in location /, and does not go below (and in / you have everything in order to give index.php).
> how to make index.php not fire when /content/ is requested
Describe what should happen in location /content/ (and by the way, it doesn't make much sense to nest it in that case).
If you have to work out the auto-index - just write. If another index page should open, just write it.
If there should be an auto-index + a ban on php, then write it like that.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question