Welcome! Log In Create A New Profile

Advanced

Re: Works only in root..

Francis Daly
March 15, 2021 01:46PM
On Mon, Mar 15, 2021 at 07:11:54AM -0400, bubugian wrote:

Hi there,

there have been some mentions of QNAP on the list in the past.

I'm not aware of any QNAP owner actually following up with a working
recipe, though.

> location /qnap{
> proxy_pass https://192.168.1.10;
> }

You probably want an extra / on those two lines:

location /qnap/ {
proxy_pass https://192.168.1.10/;
}

That will probably not fully work; if you can show the request you make
and the response you get, then maybe someone will be able to offer a
suggestion of alternate configuration.

That is: what is the response when you do something like

curl -i http://[nginx_ip]/qnap/

Possibly it is a http redirect to another url; maybe it is some content.

> when I ask browser to visit: NGINX_IP\qnap something good happens.
> In fact, I read the correct webpage name and I discover that the error page
> is not from NGINX but from QNAP.
>
> It seems that NGINX does not have success to get some of the resource behind
> my qnap NAS. Is this possible? If yes, why ?
> Why all works perfectly when, in .conf, if I change:
> - location /qnap{
> with
> - location / {

Whatever application is on the "upstream" server (the QNAP) is happy
when it is at the "root" of the web service (all requests below /); but
may not be happy when it is somewhere else (all requests below /qnap/).

> Error log shows:
> [error] 1722#1722: *74 open()
> "usr/share/nginx/html/cgi-bin/images/error/logo_gray.png failed (2: no such
> file or directory), client 192.168.xx.xx, server: , request: "GET
> /gci-bin/images/error/logo_gray.png HTTP/1.1 host: 192.168.xx.NGINX_address,
> referrer "http://192.168.xx.NGINX_address/qnap"

That looks like the content that QNAP returns include a link to something
that starts with /cgi-bin/; and your nginx config does not say how to
handle anything that starts with /cgi-bin/, and so your nginx tries to
serve the file from its filesystem.

> I have two questions:
> - does NGINX make a local copy of remote resource before building page ?

No. nginx does not build a page. Your browser makes one request, and then
later (maybe) your browser makes one request. Each request is independent.

> - is it possible that target does not answer to NGINX ? Why? Should I change
> something in .conf?

You seem to be getting a response, so the target is answering.


If it is too difficult to configure things so that the upstream (QNAP)
service will work below the url /qnap/, then it might be easier for you
to use a separate nginx server{} block, with a different server_name,
and in *that* block, do the

location / { proxy_pass... }

thing. And then if you access nginx using that server name instead or
the IP, things will probably work for qnap. If you access nginx using
a different name, whatever other config you have for that should work.

Good luck with it,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Works only in root..

bubugian March 13, 2021 04:52PM

Re: Works only in root..

Sergey A. Osokin March 14, 2021 12:00AM

Re: Works only in root..

bubugian March 15, 2021 07:11AM

Re: Works only in root..

Francis Daly March 15, 2021 01:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 58
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