server_name and listen behaviour

ivan babrou ibobrik at
Tue Feb 12 17:10:17 UTC 2013

Hi, I have a question. It's better to describe with example

I point one.local and two.local to and create following servers
in config for nginx:

server {
  listen 80;
  server_name one.local;

  location / {
    return 404;

server {
  listen two.local:80;
  server_name two.local;

  location / {
    return 403;

If I request one.local then 403 is returned. If i change listen for
one.local to one.local:80 then 404 correctly returned, but only after
restart, reload doesn't help (that's probably bug too).

I expect to get 404 if i request one.local even if I listen on all
addresses. Am I right?


Regards, Ian Babrou skype:i.babrou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list