<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Oct 31, 2020 at 5:13 AM Francis Daly <<a href="mailto:francis@daoine.org">francis@daoine.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, Oct 30, 2020 at 10:45:14PM +0530, Kaushal Shriyan wrote:<br>
> On Fri, Oct 30, 2020 at 4:35 AM Francis Daly <<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>> wrote:<br>
<br>
Hi there,<br>
<br>
> > What does the nginx access log or error log say happened to that request?<br>
<br>
> I am seeing this below message when I hit<br>
> <a href="http://219.11.134.114/test/_plugin/kibana/app/kibana" rel="noreferrer" target="_blank">http://219.11.134.114/test/_plugin/kibana/app/kibana</a><br>
> <br>
> ==> /var/log/nginx/error.log <==<br>
> 2020/10/30 17:10:57 [error] 9616#0: *20 open()<br>
> "/usr/share/nginx/html/test/_plugin/kibana/app/kibana" failed (2: No such<br>
> file or directory), client: 14.98.153.6, server: , request: "GET<br>
> /test/_plugin/kibana/app/kibana HTTP/1.1", host: "219.11.134.114"<br>
> <br>
> ==> /var/log/nginx/access.log <==<br>
> 14.98.153.6 - - [30/Oct/2020:17:10:57 +0000] "GET<br>
> /test/_plugin/kibana/app/kibana HTTP/1.1" 404 3650 "-" "Mozilla/5.0<br>
> (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko)<br>
> Chrome/86.0.4240.111 Safari/537.36" "-"<br>
<br>
When a request comes to nginx, first it decides which server{} you<br>
have configured to handle the request; then it decides which location{}<br>
in that server{} you have configured to handle the request (more or less).<br>
<br>
In this case, the request is being handled by looking at the filesystem;<br>
that means that it is handled in a location{} that does not have a<br>
proxy_pass or other similar handler defined.<br>
<br>
>  # TEST<br>
>     server {<br>
<br>
If you have shown the complete server{} block, then this is not the<br>
server{} block that the running nginx is using to handle this request.<br>
<br>
Maybe there is another location{} in the same server{} block? Or maybe<br>
there is another server{} in the same configuration? Or maybe the running<br>
nginx is using a different configuration?<br>
<br>
<br>
Some variant of "ps" should show your running nginx and any "-c" argument<br>
it has; if you copy that much and add "-T", then find the "server" and<br>
"listen" lines, it might help identify which server{} block is actually<br>
configured to be used for this request.<br>
<br>
Something like<br>
<br>
  /usr/local/sbin/nginx -c /etc/nginx.conf -T | grep -e 'server\|listen'<br>
<br>
where the first three words match whatever your system is doing, will<br>
probably be helpful.<br>
<br>
(Do read the output, and edit any information you consider private,<br>
before pasting into email.)<br>
<br>
> Also, I am not sure why it is getting referenced to /usr/share/nginx/html/?<br>
> Is there a way to change the default document root? Please suggest further.<br>
<br>
Yes, there is -- root (<a href="http://nginx.org/r/root" rel="noreferrer" target="_blank">http://nginx.org/r/root</a>).<br>
<br><br></blockquote><div><br></div><div>Hi Francis,</div><div><br></div><div>I am sharing the output of cat /etc/nginx/nginx.conf </div><div><br></div><div>OS version : CentOS Linux release 7.8.2003 (Core) </div><div>nginx version: nginx/1.16.1</div><div><br></div><div>cat /etc/nginx/nginx.conf <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># For more information on configuration, see:<br>#   * Official English Documentation: <a href="http://nginx.org/en/docs/">http://nginx.org/en/docs/</a><br>#   * Official Russian Documentation: <a href="http://nginx.org/ru/docs/">http://nginx.org/ru/docs/</a><br>user nginx;<br>worker_processes auto;<br>error_log /var/log/nginx/error.log;<br>pid /run/nginx.pid;<br># Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.<br>include /usr/share/nginx/modules/*.conf;<br>events {<br>    worker_connections 1024;<br>}<br>http {<br>    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '<br>                      '$status $body_bytes_sent "$http_referer" '<br>                      '"$http_user_agent" "$http_x_forwarded_for"';<br>    access_log  /var/log/nginx/access.log  main;<br>    sendfile            on;<br>    tcp_nopush          on;<br>    tcp_nodelay         on;<br>    keepalive_timeout   65;<br>    types_hash_max_size 2048;<br>    include             /etc/nginx/mime.types;<br>    default_type        application/octet-stream;<br>    # Load modular configuration files from the /etc/nginx/conf.d directory.<br>    # See <a href="http://nginx.org/en/docs/ngx_core_module.html#include">http://nginx.org/en/docs/ngx_core_module.html#include</a><br>    # for more information.<br>    include /etc/nginx/conf.d/*.conf;<br><br>#    PROD<br>#    server {<br>#     listen 80;<br>#     location /prod {<br>#            proxy_set_header   X-Forwarded-For $remote_addr;<br>#         proxy_set_header   Host $http_host;<br>#         #   fastcgi_read_timeout 240;<br>#            proxy_connect_timeout 600;<br>#            proxy_send_timeout 600;<br>#            proxy_read_timeout 600;<br>#            send_timeout 600;<br>#            proxy_pass         <a href="https://vpc-lab-prod-search-zvf5bfbabstbb7gi5sklqh7ll4.eu-west-1.es.amazonaws.com/">https://vpc-lab-prod-search-zvf5bfbabstbb7gi5sklqh7ll4.eu-west-1.es.amazonaws.com/</a>;<br>#        }<br>#        error_page 404 /404.html;<br>#            location = /40x.html {<br>#        }<br>#<br>#     #       location = /img {<br>#     #      index index.html index.htm index.php;<br>#     #      root /var/www/html/images/;<br>#     #   }<br>#<br>#      location /img {<br>#      root   html;<br>#      index  index.php index.html index.htm;<br>#      }<br>#        error_page 500 502 503 504 /50x.html;<br>#            location = /50x.html {<br>#        }<br>#    }<br>    # TEST<br>    server {<br>     listen 80;<br>     location /test {<br>        proxy_set_header   X-Forwarded-For $remote_addr;<br>        proxy_set_header   Host $http_host;<br>        #fastcgi_read_timeout 240;<br>        proxy_connect_timeout 600;<br>        proxy_send_timeout 600;<br>        proxy_read_timeout 600;<br>        send_timeout 600;<br>        proxy_pass         <a href="https://vpc-lab-test-search-3nrzc66u2ffd3n4ywapz7jkrde.eu-west-1.es.amazonaws.com/">https://vpc-lab-test-search-3nrzc66u2ffd3n4ywapz7jkrde.eu-west-1.es.amazonaws.com/</a>;<br>        }<br>        error_page 404 /404.html;<br>            location = /40x.html {<br>        }<br>        error_page 500 502 503 504 /50x.html;<br>            location = /50x.html {<br>        }<br>    }<br>} </blockquote><div><br></div><div><br></div>#nginx -c /etc/nginx/nginx.conf -T | grep -e 'server\|listen'<br>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok<br>nginx: configuration file /etc/nginx/nginx.conf test is successful<br>#    server {<br>#     listen 80;<br>    server {<br>     listen 80;<br><br></div><div class="gmail_quote">Please let me know if you need more details. Thanks in advance.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Best Regards,</div><div class="gmail_quote"><br></div><div class="gmail_quote">Kaushal</div><div class="gmail_quote"><br></div></div>