>
>
>
>
>
>
>
>
>
> > Hi agentzh;
>
> > 我想把前端的请求经由nginx多路转发给后台的apache以及tomcat服务器,然后对后台服务器返回的数据做一些归并和排序处理。在实验的时
> > 候,遇到了如下问题,
>
> > 2012/05/04 16:09:57 [error] 1195#0: *1 connect() failed (111:
> > Connection refused) while connecting to upstream, client:
> > 61.135.152.195, server: localhost, request: "GE\
> > T /multi HTTP/1.1", subrequest: "/s1", upstream: "http://
> >
127.0.0.1:10001/s1", host: "XXXXX.XXXX.XXXX.XXXX:10000"
>
> > 请问,为何请求是发给
http://127.0.0.1:10001/s1,而不是
http://127.0.0.1:10001呢?
>
> > 谢谢啦!
>
> > 下面是nginx.conf配置。
>
> > worker_processes 1;
> > error_log logs/error.log;
>
> > events {
> > worker_connections 51200;
> > }
>
> > http {
> > upstream cluster_1 { //apache servers
> > server localhost:10001;
> > }
>
> > upstream cluster_2 { //tomcat servers
> > server localhost:10002;
> > }
>
> > server {
> > listen 10000;
> > server_name localhost;
>
> > location /multi {
> > proxy_pass_request_headers off;
>
> > content_by_lua '
> > local res1, res2 = ngx.location.capture_multi{
> > { "/s1" },
> > { "/s2" },
> > }
>
> > ngx.say(res1.status);
> > if res1.status == ngx.HTTP_OK then
> > ngx.print(res1.body);
> > end
> > ';
> > }
>
> > location /s2 {