G
G
Grizar2019-11-19 22:32:34
Nginx
Grizar, 2019-11-19 22:32:34

How to prohibit downloading / accessing .zip .sql and .txt files in nginx by analogy with htaccess?

I have a site on the nginx+apache+centos7 server Several
WordPress sites are installed . .zip By inserting the .htaccess file in the right folder I can deny access to the folder where the .zip file is located. but when accessing the file directly, it is downloaded anyway, but it would be necessary to prohibit (tried a dozen options for the .zip file does not work) on the Internet I found out that it depends on nginx, is there any rule to apply it at the site level. and where to insert it, is there a rule for the server, and where to insert it, and how to register the path for all folders? ?
generally like that.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zolg, 2019-11-19
@Zolg

location ~ .(zip|txt|sql)$ {return 404;}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question