2

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?

1 Answer 1

6

You can deny specific file types using

location ~* \.(git|rb|inc|ht)$ {
    deny all;
}
3
  • Will this prevent files being downloaded? Commented Oct 24, 2013 at 6:37
  • 1
    How does this work if I am talking about a specific folder where these files are?
    – Ali Gajani
    Commented Jan 30, 2016 at 14:57
  • It worked for me! Commented Oct 16, 2017 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .