Help with nginx.conf file for proxying

Igor Sysoev is at rambler-co.ru
Thu Nov 2 15:38:48 MSK 2006


On Thu, 2 Nov 2006 T Gillett wrote:

> I am new to nginx and trying to work out how to set up the conf file to proxy
> some web admin pages from devices on my local network through a single ip number
> and port. IБ─≥ve read through the guides on setting up conf, but I just canБ─≥t work
> it out, or even whether it's possible.
>
> To illustrate the problem, I am trying to use nginx to proxy the webadmin page
> from a NSLU2 device. I have the two server sections shown below included in my
> nginx.conf file.
>
> The main page I want to use is on port 7007.
>
> The second server definition section successfully proxies the webadmin page
> correctly on port 7008/
>
> With the first server definition, I was attempting to bring up the webadmin page
> on port 7007/nslu2/
>
> The initial page comes up correctly, but as I navigate through the webadmin
> pages, the /nslu2/ portion of the URL is not being included, resulting in a
> Page not Found error.
>
> For example, when I click on Б─≤mydirБ─≥ in the directory tree in the NSLU2
> directory browsing page, the URL that appears in the web browser is
> http://192.168.1.77:7007/mydir
> when it needs to be:
> http://192.168.1.77:7007/nslu2/mydir
>
> My question is whether this is possible, and if so, what do I need to add to the
> server definition to make it work this way?
>
> Thanks in advance for any help on this.
>
> Cheers Terry
>
> ------------------------------------------
> server {
> 	 listen       7007;
>        server_name  localhost;
>
>        location / {
>            root   html;
>            index  index.html index.htm;
>        }
>
>
> 	 #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 Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list