E
E
enchikiben2010-10-01 08:00:52
Nginx
enchikiben, 2010-10-01 08:00:52

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

8 answer(s)
M
mazy, 2010-10-06
@EnChikiben

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;
}

V
Vladimir Chernyshev, 2010-10-01
@VolCh

server_name write whichever you need

S
Sergey, 2010-10-01
@bondbig

so ask him:
server_name ваш.нелишний.дом.ен

A
agh, 2010-10-01
@agh

clip2net.com/clip/m23235/1285916165-clip-4kb.png

S
Silbers, 2010-10-01
@silbers

Try server_name_*;

V
Vladimir Chernyshev, 2010-10-01
@VolCh

Important clarification :)
Try to insert
location = / {
return 444;
}

S
SSM, 2010-10-05
@SSM

Try this
if ($host !~ ^(your domain)$ ) {
return 444;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question