Regarding ERROR: XmlParseFailure

Hi,

I am getting this error : ERROR: XmlParseFailure

Can anybody please let me know what is the issue?

Below is my nginx.conf.

     map $uri $key2 {
             ~^(?<key>/[^/]+)/ $key;
            default "";
    }
    upstream backend {
            hash $key2 consistent;
            server 10.0.0.22:8080;
            server 10.0.0.23:8080;
            server 10.0.0.24:8080;
            server 10.0.0.25:8080;
            server 10.0.0.26:8080;
    }

        server {
            listen 90 default_server;

            location $uri {
                proxy_pass http://backend;
            }

    }

Thanks,
Panky

Hi,

Also when i checked the error log, the client request is not going to
any
upstream server. Instead it is routing to some default location.

2014/08/09 06:31:55 [info] 32681#0: *2 client 14.102.112.84 closed
keepalive connection
2014/08/09 06:36:13 [notice] 329#0: signal process started
2014/08/09 06:36:13 [notice] 32669#0: signal 1 (SIGHUP) received,
reconfiguring
2014/08/09 06:36:13 [notice] 32669#0: reconfiguring
2014/08/09 06:36:13 [notice] 32669#0: using the “epoll” event method
2014/08/09 06:36:13 [notice] 32669#0: start worker processes
2014/08/09 06:36:13 [notice] 32669#0: start worker process 330
2014/08/09 06:36:14 [notice] 32681#0: gracefully shutting down
2014/08/09 06:36:14 [notice] 32681#0: exiting
2014/08/09 06:36:14 [notice] 32681#0: exit
2014/08/09 06:36:14 [notice] 32669#0: signal 17 (SIGCHLD) received
2014/08/09 06:36:14 [notice] 32669#0: worker process 32681 exited with
code
0
2014/08/09 06:36:14 [notice] 32669#0: signal 29 (SIGIO) received
2014/08/09 06:36:19 [error] 330#0: *3 “/etc/nginx/html/index.html” is
not
found (2: No such file or directory), client: 14.102.112.84, server: ,
request: “GET / HTTP/1.1”, host: “65.60.72.19:90”
2014/08/09 06:36:19 [info] 330#0: *3 client 14.102.112.84 closed
keepalive
connection

Why it is happening?

Thanks,
Panky

On Sat, Aug 9, 2014 at 6:44 PM, Pankaj K. [email protected]

On Sat, Aug 09, 2014 at 07:08:55PM +0530, Pankaj K. wrote:

Hi there,

Also when i checked the error log, the client request is not going to any
upstream server. Instead it is routing to some default location.

request: “GET / HTTP/1.1”, host: “65.60.72.19:90”

Why it is happening?

Your request is for “/”. The only location block you have is a prefix
match for the four-character string “$uri”, which does not match
your request, so the request is processed by the default server-level
configuration.

f

Francis D. [email protected]

Hey Francis,

Your request is for “/”. The only location block you have is a prefix
match for the four-character string “$uri”, which does not match
your request, so the request is processed by the default server-level
configuration.

I have understanding that $uri will be changed to actual uri when
location
block will be parsed.

why is it not happening?

There are two scenario in my case.

My uri can contain two values one is “/” and other is let say “/abc/def”
(this value is dynamic and can change according to the client request).

So i want to redirect above uri values to different upstream server.

How can i do this?

I tried below configuration but it did not worked for uri location
block.

upstream backend {
hash $key2 consistent; // this will be used for given
bucket name based on consistent hash policy
server 10.0.0.22:8080;
server 10.0.0.23:8080;
server 10.0.0.24:8080;
server 10.0.0.25:8080;
server 10.0.0.26:8080;
}
upstream backend_2 {
server 10.0.0.22:8080;
server 10.0.0.23:8080;
server 10.0.0.24:8080;
server 10.0.0.25:8080;
server 10.0.0.26:8080;
}

        server {
            listen 90 default_server;

            location $uri {
                proxy_pass http://backend;
            }
            location / {
                proxy_pass http://backend_2;
            }
    }

Can you please suggest me right step on this?

Thanks,
Panky

On Sun, Aug 10, 2014 at 10:12:32AM +0530, Pankaj K. wrote:

Hi there,

I have understanding that $uri will be changed to actual uri when location
block will be parsed.

Your understanding is wrong.

why is it not happening?

Because your understanding is wrong.

There are two scenario in my case.

My uri can contain two values one is “/” and other is let say “/abc/def”
(this value is dynamic and can change according to the client request).

location = / {
# config for when the request is exactly “/”
}
location / {
# config for when the request is anything else that starts with “/”
}

http://nginx.org/r/location

So i want to redirect above uri values to different upstream server.

How can i do this?

Put the right config in the right location{}.

f

Francis D. [email protected]