Answer the question
In order to leave comments, you need to log in
How to whitelist URLs in nginx config?
Hello. the essence of the question is that you need to register a certain check whether there is such a URL and if it is not there, then issue 404.
a piece of the config file is what I tried to do:
server
{
listen localhost:80;
server_name example.com;
charset utf-8;
location / {
root /var/www/html/;
try_files $uri $uri/ /index.html; \\редирект всех запросов на index.html
index index.html;
location ~* !^(\/|css|balance|deposit|signup|profilelogin|settings|static|fonts|img|index\.html|favicon\.ico)/
{
return 404;
break;
}
}
}
Answer the question
In order to leave comments, you need to log in
decided like this. suddenly someone will be useful. thanks to the kind person from stackoverflow
location / {
return 404;
}
location ~ ^/(signup|market|support|profie|login|settings|index\.html|static|fonts|img|$) {
try_files $uri $uri/ /index.html;
}
location = /{
try_files $uri $uri/ /index.html;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question