V
V
vkrutik2020-05-27 12:09:38
Nginx
vkrutik, 2020-05-27 12:09:38

How to restrict Nginx access?

Hello, please tell me how to restrict access to the site, but so that one of the files still has access?

This design immediately came to mind.

location / {
           deny all;
        }


But how can I change it so that only one info.php file can be accessed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-05-27
@dodo512

location / {
    deny all;
}

location = /info.php {
    fastcgi_pass ... ;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question