Query on nginx. conf file regarding redirection.

Francis Daly francis at daoine.org
Fri Oct 30 23:43:38 UTC 2020

On Fri, Oct 30, 2020 at 10:45:14PM +0530, Kaushal Shriyan wrote:
> On Fri, Oct 30, 2020 at 4:35 AM Francis Daly <francis at daoine.org> wrote:

Hi there,

> > What does the nginx access log or error log say happened to that request?

> I am seeing this below message when I hit
> ==> /var/log/nginx/error.log <==
> 2020/10/30 17:10:57 [error] 9616#0: *20 open()
> "/usr/share/nginx/html/test/_plugin/kibana/app/kibana" failed (2: No such
> file or directory), client:, server: , request: "GET
> /test/_plugin/kibana/app/kibana HTTP/1.1", host: ""
> ==> /var/log/nginx/access.log <==
> - - [30/Oct/2020:17:10:57 +0000] "GET
> /test/_plugin/kibana/app/kibana HTTP/1.1" 404 3650 "-" "Mozilla/5.0
> (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko)
> Chrome/86.0.4240.111 Safari/537.36" "-"

When a request comes to nginx, first it decides which server{} you
have configured to handle the request; then it decides which location{}
in that server{} you have configured to handle the request (more or less).

In this case, the request is being handled by looking at the filesystem;
that means that it is handled in a location{} that does not have a
proxy_pass or other similar handler defined.

>  # TEST
>     server {

If you have shown the complete server{} block, then this is not the
server{} block that the running nginx is using to handle this request.

Maybe there is another location{} in the same server{} block? Or maybe
there is another server{} in the same configuration? Or maybe the running
nginx is using a different configuration?

Some variant of "ps" should show your running nginx and any "-c" argument
it has; if you copy that much and add "-T", then find the "server" and
"listen" lines, it might help identify which server{} block is actually
configured to be used for this request.

Something like

  /usr/local/sbin/nginx -c /etc/nginx.conf -T | grep -e 'server\|listen'

where the first three words match whatever your system is doing, will
probably be helpful.

(Do read the output, and edit any information you consider private,
before pasting into email.)

> Also, I am not sure why it is getting referenced to /usr/share/nginx/html/?
> Is there a way to change the default document root? Please suggest further.

Yes, there is -- root (http://nginx.org/r/root).

But that is not the problem here.


Francis Daly        francis at daoine.org

More information about the nginx mailing list