Answer the question
In order to leave comments, you need to log in
nginx - one domain
Hello!
Tell me how to configure nginx so that it does not accept extra domains. Now for some reason it accepts all domains. I tried it through
Let me clarify, I made a config for my domain, I need nginx to cut off all unnecessary domains.
server {
listen 80 default;
server_name _;
access_log /dev/null;
error_log /dev/null;
return 444;
}
Answer the question
In order to leave comments, you need to log in
and what's the problem with making 2 server records - is it default for everything and one for the correct domain?
server {
listen 80 default;
server_name noname;
access_log /dev/null;
error_log /dev/null;
return 444;
}
server {
listen 80;
server_name www.myname.com;
root /var/www/htdocs;
}
Important clarification :)
Try to insert
location = / {
return 444;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question