Help with nginx.conf file for proxying

Igor Sysoev is at rambler-co.ru
Fri Nov 3 11:21:45 MSK 2006


On Fri, 3 Nov 2006, T Gillett wrote:

> Igor Sysoev <is at ...> writes:
>
>>>
>>> 	 #proxy NSLU2 web admin, located on 192.168.1.77:80
>>> 	 location /nslu2/ {
>>>          	  proxy_pass      http://192.168.1.77:80/;
>>
>> You should change the line above to
>>
>>           	  proxy_pass      http://192.168.1.77:80/nslu2/;
>> or to
>>           	  proxy_pass      http://192.168.1.77:80;
>>
>>>         	  proxy_redirect  default;
>>>        }
>>>    }
>>>
>>>  server {
>>> 	   listen       7008;
>>>          server_name  nslu2;
>>>
>>> 	   #proxy NSLU2 web admin
>>> 	   location / {
>>>          	  proxy_pass      http://192.168.1.77:80/;
>>>          	  proxy_redirect  default;
>>>          }
>>>    }
>
>
> Igor
> Thanks for the response. A couple of points:
>
> -	The address in the proxy_ pass line has to have the trailing / or it doesnЪЪt
> bring up the page at all.
> -	The home page of the NSLU2 device is at   http://192.168.1.77:80. If I add the
> /nslu2/ as you suggest I get a ЪЪPage not foundЪЪ screen back from the NSLU2
>
> To illustrate the problem, the two sequences below show the series of URLs that
> are used when accessing the NSLU2 device directly, and then through the proxy
> server. Both work the same until I get to the third step when it fails through
> the proxy server. This is obviously because there is no valid page at
> http://192.168.1.77:7007/mydir.
> The required page is at http://192.168.1.77:7007/nslu2/mydir
>
> If I manually edit the URL in the browser to include /nslu2 in front of the
> /mydir in the URL it goes to the right page. The same will happen for all
> further links.
>
> Accessing the NSLU2 directly:
> Start at Home page:   http://192.168.1.77/
> Login link on Home page:  http://192.168.1.77/login.cgi
> Browse Files page, select mydir:  http://192.168.1.77/mydir/
>
> Accessing the NSLU2 through nginx with my conf file:
> Start at Home page:   http://192.168.1.77:7007/nslu2/
> Login link on Home page:  http://192.168.1.77:7007/nslu2/login.cgi
> Browse Files page, select mydir:  http://192.168.1.77:7007/mydir
>
> It seems to me that I am missing something in the conf file to make the proxy
> server include 7007:/nslu2 in the URL instead of just :7007

nginx can not change proxied HTML. If backend outputs "<a href="/mydir">,
nginx can not change it. The only way to proxy such site via nginx is
using second server method on port 7008.


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





More information about the nginx mailing list