all request is redirected to one port if there is multiple listen in default server section

Delta Yeh delta.yeh at gmail.com
Fri Apr 10 06:24:59 MSD 2009


I use the following config:

server {
                    listen 192.168.1.102:80;
                        listen 192.168.1.102:81;

        server_name  _;  #default
        return 444;
    }

#upstream cfg
        upstream web_upstream0 {
        server 192.168.39.100:81 max_fails=3  fail_timeout=30s;

    }
        upstream web_upstream1 {
        server 192.168.39.100 max_fails=3  fail_timeout=30s;

    }

server {
     listen 192.168.1.102:81;
    server_name www.test1.com;
     location / {

            proxy_pass http://web_upstream0/;
    }
}
server {
     listen 192.168.1.102:80;
    server_name www.test2.com;
     location / {

            proxy_pass http://web_upstream1/;
    }
}


It seems all request to  www.test1.com is passed to www.test2.com.


If I use:

server {
                    listen 192.168.1.102:80;

        server_name  _;  #default
        return 444;
    }
server {
                        listen 192.168.1.102:81;

        server_name  _;  #default
        return 444;
    }

instead, every thing is OK.
Is this a bug ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090410/786fb9ab/attachment.html>


More information about the nginx mailing list