on my nginx server if people are using the /media path they can see a list of the whole folder with every file. How can I block that the people are seeing that, like with a 404 page. But I cant disable it in general because I refer to that path with images and stuff on other pages. So in conclusion I need to disable /media path for users but not for the server itself.
I’m using django.
Greetings and thanks for your help
2
Answers
I think you just stumbled upon a common issue in Django. To me, there are several solutions, but there may be issues coming with the solution:
EDIT:
I think this answers explains the latter https://stackoverflow.com/a/43223478/9938410
I suspect your nginx is configured with
autoindex on
which will generate a full directory listing for the path requested. When serving static content for your website, you typically will want to disableautoindex
.Nginx docs provide more details on these settings.