Awesome q2a theme

nginx one domain

0 like 0 dislike
128 views
Hello!
Tell me how to configure nginx to not take the extra domains. Now why is it accepts all domains. Tried using
server {
listen 80 default;
server_name _;
access_log /dev/null;
error_log /dev/null;
return 444;
}


To clarify, my domain config I have done, I need nginx to cut off all the extra domains.
by | 128 views

7 Answers

0 like 0 dislike
and what's the problem to make 2 entries server — it takes default for everything and one for the right domain?
\r
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;
}
by
0 like 0 dislike
server_name write that you need
by
0 like 0 dislike
Duc ask him:
\rserver_name your.it is useful.house.Yong
by
0 like 0 dislike
by
0 like 0 dislike
Try server_name _ *;
by
0 like 0 dislike
Important clarification :)
\r
Try to insert
\r
location = / {
return 444;
}
by
0 like 0 dislike
Try this option
\r
if ($host !~ ^(your domain)$ ) {
return 444;
}
by

Related questions

0 like 0 dislike
1 answer
asked Jun 10, 2019 by hazratgs
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users