nginx deny directory and files to be downloaded

Posted by YeppThat'sMe on Server Fault See other posts from Server Fault or by YeppThat'sMe
Published on 2013-10-23T21:48:09Z Indexed on 2013/10/23 21:55 UTC
Read the original article Hit count: 206

Filed under:
|
|

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?

© Server Fault or respective owner

Related posts about nginx

Related posts about protection