# Help with nginx configuration

**URL:** <https://www.ruby-forum.com/t/help-with-nginx-configuration/153995>\
**Category:** NGINX\
**Created:** [November 24, 2008, 1:06pm UTC](https://www.ruby-forum.com/t/help-with-nginx-configuration/153995 "2008-11-24T13:06:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![just\_starting](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@just\_starting](https://www.ruby-forum.com/u/just_starting)\
**Post date:** [November 24, 2008, 1:06pm UTC](https://www.ruby-forum.com/t/help-with-nginx-configuration/153995/1 "2008-11-24T13:06:20Z")

</div>

Hi,

Please consider this following scenario.

I have 2 servers(1 jetty and the other is apache) with nginx as proxy  
servers to both.

I forward all the jsp queries to jetty and all the php queries to apache  
httpd and serve the static content of both the servers by nginx.

Now the problem is there is one xml file “top.xml”, generated by httpd  
which  
i must send the request to httpd and also i need to send all the request  
to  
\*.xml to jetty(i have asked the dev team to make sure there is no  
top.xml  
file in jetty).

Can you suggest some configuration settings to achieve this.

Right now I have tried that for top.xml go to httpd and for \*.xml go to  
jetty, but clearly the rule with \*.xml overrides the top.xml condition.

My question is how the rules in the conf file processed when it comes to  
proxying the request to different servers.

Thanks,

Rakesh.

---

<div class="post-metadata">

**Author:** ![just\_starting](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@just\_starting](https://www.ruby-forum.com/u/just_starting)\
**Post date:** [November 24, 2008, 1:23pm UTC](https://www.ruby-forum.com/t/help-with-nginx-configuration/153995/2 "2008-11-24T13:23:28Z")

</div>

Hi Rakesh,

The rules for location matching are layed out here

[http://wiki.codemongers.com/NginxHttpCoreModule#location](http://wiki.codemongers.com/NginxHttpCoreModule#location)

I think what you are trying to do might look like this

server {

server\_name …

include proxy.conf;

# match exactly /top.xml

location = /top.xml {  
proxy\_pass [http://apache](http://apache);  
}

# match \*.xml {

location ~\* .xml {  
proxy\_pass [http://jetty](http://jetty)  
}

}

Cheers

Dave

---

<div class="post-metadata">

**Author:** ![just\_starting](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@just\_starting](https://www.ruby-forum.com/u/just_starting)\
**Post date:** [November 25, 2008, 10:57am UTC](https://www.ruby-forum.com/t/help-with-nginx-configuration/153995/3 "2008-11-25T10:57:26Z")

</div>

I will try it and post my findings soon.

Thanks,

Rakesh.
