Answer the question
In order to leave comments, you need to log in
(nginx) How to deny access to folders, but allow to files?
Hello. I have nginx, and it is responsible for the statics on the server, giving the rest to Apache through a proxy pass.
Recently I ran into a problem: you can go to the site at / css (css folder in the static folder) and see a list of files. This is bad behavior, but the only way I was able to solve it was: location /static/ { deny all; }
Now file listings are not displayed, however, despite the fact that the following rule follows -
location ~* .(jpeg|jpg|...другие типы данных)$ {
root /home/sitename/public_html/;
access_log off;
expires 30d;
}
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