S
S
Sazanovdm2021-03-23 17:20:39
Nginx
Sazanovdm, 2021-03-23 17:20:39

How to deny access to a folder and files inside Nginx?

location / {
allow 123.456.789.1;
deny all;
}


Yes, it works, but if you access the internal files of the folder, then there are no restrictions, i.e. index.php will be executed.

Question: How to deny access to all folders on the server and files inside.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-03-23
@Sazanovdm

Obviously, the request does not fall into location / {, but somewhere like location ~ \.php$ {
You can move allow and deny directly into the server block.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question