Nginx执行不当" post_action"

时间:2014-08-15 10:20:59

标签: nginx

好的,所以我得到了以下配置:

server {
    listen 1001;
    root /home;

    location / {    
        try_files /data$uri = 404;
        post_action @pa_a;
    }

    location @pa_a {
        internal;
        proxy_pass http://post_action_server:8033;
        proxy_set_header  ACTION "A";
        proxy_set_header  Bytes-Sent        $bytes_sent;
        proxy_set_header  Host              $host;
        proxy_set_header  X-Real-IP          $remote_addr;
        proxy_set_header  X-Forwarded-For    $proxy_add_x_forwarded_for;
        proxy_set_header  X_Forwarded_Proto  $scheme;
        proxy_pass_request_body off;
        proxy_pass_request_headers on;
   }

    location  / {
        deny all; 
    }
}

server {
    listen 2001;
    root /home;

    location / {
        try_files /data$uri =404;
        post_action @pa_b;
    }

    location @pa_b {
        internal;
        proxy_pass http://post_action_server:8033;
        proxy_set_header  ACTION "B";
        proxy_set_header  Bytes-Sent        $bytes_sent;
        proxy_set_header  Host              $host;
        proxy_set_header  X-Real-IP          $remote_addr;
        proxy_set_header  X-Forwarded-For    $proxy_add_x_forwarded_for;
        proxy_set_header  X_Forwarded_Proto  $scheme;
        proxy_pass_request_body off;
        proxy_pass_request_headers on;
    }

    location  / {
        deny all; 
    }
}

问题在于,当我向第二个服务器(port: 2001)发送请求时,它调用@pa_b而不是调用@pa_a。这是nginx中的错误吗?因为它看起来像这样。侦听完全不同的端口的服务器如何调用另一个服务器配置中定义的post_action

0 个答案:

没有答案