server_name "";
merlin corey
merlincorey at dc949.org
Sat Dec 19 04:38:28 MSK 2009
On Fri, Dec 18, 2009 at 3:04 PM, Sean Allen <sean at monkeysnatchbanana.com> wrote:
> On Fri, Dec 18, 2009 at 5:51 PM, Peter Leonov <gojpeg at gmail.com> wrote:
>> On 19.12.2009, at 1:14, Sean Allen wrote:
>>
>>> we are running 0.7.64
>>>
>>> have this as a server:
>>>
>>> server
>>> {
>>> server_name "";
>>>
>>> location /
>>> {
>>> return 404;
>>> }
>>> }
>>>
>>> when we try to startup we get:
>>>
>>> [emerg]: the first server name must not be empty in
>>> /ah/conf/nginx/default_server.conf:4
>>>
>>> wiki says:
>>>
>>> Since nginx 0.7.12, an empty server name is supported, to catch the
>>> requests without "Host" header:
>>>
>>> server {
>>> server_name "";
>>> }
>>
>> We use the underscore + listen default.
>>
>> server
>> {
>> server_name _;
>> listen 80 default;
>> location / { return 404; }
>> }
>>
>
> That works except, it is getting blocked by another and I'm not sure why.
> I'm doing this on a local network right now and m.example.com is 192.16.8.1.125
> if m.example.com is setup then this doesn't get used.
>
> m.example.com has:
>
> server
> {
> listen m.example.com;
> server_name m.example.com;
> }
>
> So from the wiki,
> if I do a request not to m.example.com but 192.168.1.125
> shouldnt the listen 80 default server block be the one that handles
> the response?
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
FYI Igor's latest documents at:
http://nginx.org/en/docs/http/request_processing.html suggest the
following configuration:
server {
listen 80 default_server;
server_name _;
return 444;
}
You will note that now we use default_server, the server_name _, and
no need for a location to hold the return code.
-- Merlin
More information about the nginx
mailing list