Welcome! Log In Create A New Profile

Advanced

Re: path-based reverse proxy

September 06, 2010 09:18AM
On Sat, Sep 04, 2010 at 05:25:25AM -0400, cantabile wrote:

> Hi all,
>
> I'm new to nginx and I'm looking for a path-based reverse-proxy.
> Here's my setup.
>
> nginx server has $PUB_IP, listening to port 80
> I have two webservers with $IP1 and $IP2
>
> I want to access my main server from a browser with http://$PUB_IP and
> the second server with http://$PUB_IP/myapp
>
> I can't find how to do it.
>
> I tried defining two servers in sites-available, default and myapp, but
> since they listen on the same port, I always have the same server with
> both http://$pub_ip and http://$pub_ip/myapp. Seems logical to me since
> nothing can tell nginx wich server it was supposed to redirect to.
>
> I have tried to put another location in site-available/default, like
> this
>
> server {
> ...
> location / {
> proxy_pass http://$IP1
> }
>
> location /myapp {
> proxy_pass http://$IP2
> }
> }
>
> But that doesn't work. I can only have the main page of site2, not even
> the images in the same directoriy. And by the way that looks wrong,
> 'cause site2 isn't another directory of site1, it's another
> webserver...

The problem that images in $IP2's HTML has links something like
<img src="/..."> while you need <img src="/myapp/...">.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

path-based reverse proxy

cantabile September 04, 2010 05:25AM

Re: path-based reverse proxy

UnclePhil September 06, 2010 07:14AM

Re: path-based reverse proxy

Igor Sysoev September 06, 2010 09:16AM

Re: path-based reverse proxy

UnclePhil September 06, 2010 07:16AM

Re: path-based reverse proxy

Igor Sysoev September 06, 2010 09:18AM

Re: path-based reverse proxy

cantabile September 08, 2010 06:23AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready