Welcome! Log In Create A New Profile

Advanced

How to proxy / and /subdir to different servers?

Posted by ptichkin 
How to proxy / and /subdir to different servers?
August 21, 2013 05:41PM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 148
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready