Answer the question
In order to leave comments, you need to log in
How to prevent opening files with a certain extension?
Whether prompt there is an option to forbid access to certain files.
There is a static/plugins/ folder on the server.
It contains plugins for the site, for example, a slider or select styling. These folders usually contain a lot of extra files, documentation, demo version, etc. And it is JS, CSS, image files that are important, the rest I would like to close, restrict access to them.
Is it possible to make such a setting?
Answer the question
In order to leave comments, you need to log in
Of course, I think that the following construction can help:
# Указываем расширения файлов, которые можно использовать в каталоге:
location ~* ^/static/plugins/.+\.(css|js|png)$ {
root /var/www/site.ru/;
}
# Следующий локейшен будет запрещать доступ в этот каталог для всех, не указанных ранее, расширений файлов
location ~* ^/static/plugins/ {
return 403;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question