Opened 12 years ago

Closed 12 years ago

#60 closed defect (invalid)

Не работает деректива default без явного указания ip.

Reported by: sergeyvl.myopenid.com Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: Cc:
uname -a: Linux 2.6.32-5-amd64 #1 SMP Mon Oct 3 03:59:20 UTC 2011 x86_64 GNU/Linux
nginx -V: nginx version: nginx/0.7.67
TLS SNI support enabled
configure arguments: --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/tmp/buildd/nginx-0.7.67/modules/nginx-upstream-fair

Description

В отдельном файле конфигурируется следующий сервер:

server {
    listen 80 default;
    server_name _;
    return 444;
}

Кроме него есть еще несколько серверов, каждый в отдельном файле.

В таком случае, по адресу http://192.168.32.17 открывается один из серверов(сайтов), и ошибка не возвращается. Судя по документации, должна возвращаться пустая страница.

Если же явно указать ip, например так:

server {
    listen 192.168.32.17:80 default;
    server_name _;
    return 444;
}


то по запросу http://192.168.32.17 возвращается ошибка, как и должно быть.

Change History (1)

comment:1 by Maxim Dounin, 12 years ago

Resolution: invalid
Status: newclosed

Most likely (some) other servers are listening on the ip, not on "*". Ip is more specific and a server with listen on "*" won't be considered for requests to a particular ip if there are server(s) defined with listen on the ip in question. Very much like how sockets work.

Note: See TracTickets for help on using tickets.