Answer the question
In order to leave comments, you need to log in
How to apply nginx location rules for images only on the main page (root) of a site?
Hello!
There is a task: it is necessary to apply rules only to images on the main page of the site example.com/ using location NGINX
For the test, I created a directory inside the site /test/
What directives to write in location so that example.com/1.jpg is processed , but not example is processed .com/test/1.jpg ?
At the moment the config is:
server {
...
location / {
...
}
location ~* ^/.*\.jpg$ {
...
}
server {
...
location / {
...
}
location ~* ^/test/.*\.jpg$ {
...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question