Answer the question
In order to leave comments, you need to log in
How can the nginx balancer "teach" to give a static page, for example index.php?
Good afternoon.
Please tell me whether it is possible to replace the index.php page on the nginx balancer, and send requests to other pages to upstreams.
Thanks in advance :)
Answer the question
In order to leave comments, you need to log in
In the code below: nginx first checks for the exact specified address (with an equals sign). Everything else will not match and will be proxied.
server {
root ...;
index index.php;
location = /index.php {
# do what you want with it
fastcgi_pass /path/to/fpm/sock/file;
}
location / {
# not matching /index.php here, so passing over to upstream
proxy_pass http://your.upstream/;
...
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question