Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

How to proxy / and /subdir to different servers?

$
0
0
Hello!

I need to proxy / to one server in 192.168.xx.yy network and /subsite to another server
i need to http://myhost.tld/ refer to www server on machine 192.168.1.55
and http://myhost.tld/subsite1 to machine 192.168.1.1
and http://myhost.tld/subsite2 to machine 192.168.1.2

my vhost config is:

root /var/www/myhost.tld/htdocs;
location /subsite1
{
proxy_pass http://192.168.1.1;
}
location /subsite2
{
proxy_pass http://192.168.1.2;

}
#main site
location /
{
proxy_pass http://192.168.1.55;
}



it does not work: the last directive override the previous and /subsite1 and /subsite2 is started to handle with wwwserver on 192.168.1.55, not nginx.

how can i write the suitable config?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>