nginx deny directory and files to be downloaded
11,728
You can deny specific file types using
location ~* \.(git|rb|inc|ht)$ {
deny all;
}
Related videos on Youtube
Author by
YeppThat'sMe
Updated on September 18, 2022Comments
-
YeppThat'sMe almost 2 years
gurus. I have a problem and i dont know how to solve it. I am working with Git and Compass/SASS on some projects. Now i want to protect those directories. When i go only to the folder its all fine – i get what i expected a 403 forbidden.
location ~ /\.git { deny all; }
But when i try use the full path to the config file from git the browser start to download it. Same scenario with compass. There is a
config.rb
file within the folder which also starts to download it. How can i prevent this behaviour?How can i deny downloading specific files?
-
YeppThat'sMe over 10 yearsWill this prevent files being downloaded?
-
Ali Gajani over 8 yearsHow does this work if I am talking about a specific folder where these files are?
-
Fernando Paladini over 6 yearsIt worked for me!