nginx Digest, Vol 140, Issue 3

Amila Gunathilaka amila.kdam at gmail.com
Sun Jun 6 08:44:33 UTC 2021


Dear Mr Francis,

issue 1.)
> That is almost certainly because you also have "proxy_cache" (
http://nginx.org/r/proxy_cache) and "proxy_cache_path" defined, but
configured to use part of the filesystem that the nginx user     -  is not
allowed to use -- maybe it was created or first run as one user, and now
this user cannot write there?

> The simplest-to-understand fix, assuming that this is a test system where
you are happy to start again, is probably to stop nginx, remove the
/var/lib/nginx/proxy/ directory and all of its
   -  contents, create the directory again as the user that nginx runs as,
and then start nginx.

I actually didn't have any  "proxy_cache" or  "proxy_cache_path" defined in
my nginx.conf file but I did remove  /var/lib/nginx/proxy/ directory and
re-create as you requested and yes now I'm not getting any
permission-denied error or any error in the error.log file when I access
the url.   So thank you for this !


issue 2.)

 >   Something like

 >   location = / { return 301 /metrics/; }

 >    should probably work. Any access control on /metrics/ would still
apply
 >    to the next request that the client makes, so it probably is ok not to
 >    require authentication for this one request.

This also working Mr Francis.  now I have my nginx.conf  file look like
below.

worker_rlimit_nofile 30000;
events {
    worker_connections 30000;
}

http {

      server {
        listen 80;
        server_name 172.25.234.105 push.metrics.townsuite.com;
        #return 301 http://push.metrics.townsuite.com/metrics;
        #proxy_set_header Host push.metrics.townsuite.com/metric;
        location = / { return 301 /metrics/; }
        location /metrics {
             #proxy_set_header Host 172.25.234.105/metrics;
             proxy_pass http://127.0.0.1:9091/metrics;
             #proxy_redirect http://push.metrics.townsuite.com
http://push.metrics.townsuite.com/metrics
             #proxy_set_header Host push.metrics.townsuite.com/metrics;
             auth_basic "PROMETHEUS PUSHGATEWAY Login Area";
             auth_basic_user_file /etc/nginx/.htpasswd;
        }

            }
}

All good now !!!  Thanks again for your immense help.  I would like to
contact you in future also about any nginx matters, we  may can share
knowledge (my area is kubernetes/aws actually).

Amila
Devops Engineer
AWS, RHCSA, RHCE, CKA



On Thu, Jun 3, 2021 at 2:47 AM <nginx-request at nginx.org> wrote:

> Send nginx mailing list submissions to
>         nginx at nginx.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mailman.nginx.org/mailman/listinfo/nginx
> or, via email, send a message with subject or body 'help' to
>         nginx-request at nginx.org
>
> You can reach the person managing the list at
>         nginx-owner at nginx.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of nginx digest..."
>
>
> Today's Topics:
>
>    1. Re: Help: Using Nginx Reverse Proxy bypass traffic in to a
>       application running in a container (Francis Daly)
>    2. How to install nginx-module-njs on alpine (bouvierh)
>    3. Partial cached fastsgi responses? (TBD TBD)
>    4. Re: How to install nginx-module-njs on alpine (Thomas Ward)
>    5. Re: How to install nginx-module-njs on alpine (Grzegorz Kulewski)
>    6. Re: How to install nginx-module-njs on alpine (Sergey A. Osokin)
>    7. Re: How to install nginx-module-njs on alpine (Sergey A. Osokin)
>    8. RE: Partial cached fastsgi responses? (TBD TBD)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 2 Jun 2021 16:27:15 +0100
> From: Francis Daly <francis at daoine.org>
> To: nginx at nginx.org
> Subject: Re: Help: Using Nginx Reverse Proxy bypass traffic in to a
>         application running in a container
> Message-ID: <20210602152715.GN11167 at daoine.org>
> Content-Type: text/plain; charset=us-ascii
>
> On Tue, Jun 01, 2021 at 07:40:27PM +0530, Amila Gunathilaka wrote:
>
> Hi there,
>
> > Hope you are doing good ?  Thanks for your quick responses for my emails
> > again.  I have 02 questions  for you today,  I will brief it down for
> your
> > ease.
>
> You're welcome.
>
> In general, if the questions are unrelated to the first one, it's best
> to start a new mail. That'll help someone search for questions and
> answers in the future.
>
> In this case, they are kind-of vaguely related, so we'll keep[ them in
> this thread.
>
> > But when I tail the /var.log/nginx/error.log file for
> > a moment and even after I log in by type username and password the error
> > log gives below error message unless the login is successful.
> >
> >
> > *tail -f  /var.log/nginx/error.log output*
> > 2021/06/01 11:25:26 [crit] 2379013#2379013: *57800 open()
> > "/var/lib/nginx/proxy/4/79/0000002794" failed (*13: Permission denied*)
> > while reading upstream, client: 172.20.0.201, server: 172.25.234.105,
> > request: "GET /metrics HTTP/1.1", upstream: "
> http://127.0.0.1:9091/metrics",
> > host: "172.25.234.105"
> >
> >
> > So my first quiz is why it gives a Permission denied message for my
> request
> > through the browser even after I enter credentials and I can view
> /metrics
> > page contents.
>
> That is almost certainly because you also have "proxy_cache"
> (http://nginx.org/r/proxy_cache) and "proxy_cache_path" defined, but
> configured to use part of the filesystem that the nginx user is not
> allowed to use -- maybe it was created or first run as one user, and
> now this user cannot write there?
>
> The simplest-to-understand fix, assuming that this is a test system
> where you are happy to start again, is probably to stop nginx, remove
> the /var/lib/nginx/proxy/ directory and all of its contents, create the
> directory again as the user that nginx runs as, and then start nginx.
>
> You should then see directories and files created, as cacheable responses
> are fetched.
>
> (There are other possible fixes too, of course.)
>
> > *quiz (2.) : * My second question for you is if I want to redirect the
> url,
> > such as when I enter  http://172.25.234.105:80  I want it to
> automatically
> > redirect it to the page   http://172.25.234.105/metrics. How could I
> > achieve that via nginx ?
>
> Something like
>
>     location = / { return 301 /metrics/; }
>
> should probably work. Any access control on /metrics/ would still apply
> to the next request that the client makes, so it probably is ok not to
> require authentication for this one request.
>
> Good luck with it,
>
>         f
> --
> Francis Daly        francis at daoine.org
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 02 Jun 2021 15:15:16 -0400
> From: "bouvierh" <nginx-forum at forum.nginx.org>
> To: nginx at nginx.org
> Subject: How to install nginx-module-njs on alpine
> Message-ID:
>         <
> 6a4411929c09c44b47f51090d1e05e8a.NginxMailingListEnglish at forum.nginx.org>
>
> Content-Type: text/plain; charset=UTF-8
>
> Hello,
>
> How do I install the javascript module on Alpine? I have tried: "apk add
> nginx-module-njs" but that module is not available.
> ERROR: unable to select packages:
>   nginx-module-njs (no such package):
>
> Thanks,
> Hugues
>
> Posted at Nginx Forum:
> https://forum.nginx.org/read.php?2,291725,291725#msg-291725
>
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 2 Jun 2021 19:28:26 +0000
> From: TBD TBD <piersh at hotmail.com>
> To: "nginx at nginx.org" <nginx at nginx.org>
> Subject: Partial cached fastsgi responses?
> Message-ID:
>         <
> BYAPR07MB6376ED987DB8F2B5EAE172A6DA3D9 at BYAPR07MB6376.namprd07.prod.outlook.com
> >
>
> Content-Type: text/plain; charset="windows-1252"
>
> Is it possible to use the ?Range: bytes=? header with cached fastcgi
> locations? What config option do I need to use to get a cached fastcgi
> response to contain an `Accept-Ranges` header?
>
> Does the `fastcgi_force_ranges` config option even do anything?
>
> Piers.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.nginx.org/pipermail/nginx/attachments/20210602/bb183372/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 4
> Date: Wed, 2 Jun 2021 16:34:13 -0400
> From: Thomas Ward <teward at thomas-ward.net>
> To: nginx at nginx.org, bouvierh <nginx-forum at forum.nginx.org>
> Subject: Re: How to install nginx-module-njs on alpine
> Message-ID: <f5d9b89a-7418-093f-ea4a-73eb0a5c8552 at thomas-ward.net>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> More than likely you'll have to compile the module yourself - I don't
> know of any distribution that currently ships the njs module.
>
>
> Thomas
>
>
> On 6/2/21 3:15 PM, bouvierh wrote:
> > Hello,
> >
> > How do I install the javascript module on Alpine? I have tried: "apk add
> > nginx-module-njs" but that module is not available.
> > ERROR: unable to select packages:
> >    nginx-module-njs (no such package):
> >
> > Thanks,
> > Hugues
> >
> > Posted at Nginx Forum:
> https://forum.nginx.org/read.php?2,291725,291725#msg-291725
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.nginx.org/pipermail/nginx/attachments/20210602/6bc25d19/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 5
> Date: Wed, 2 Jun 2021 22:37:15 +0200
> From: Grzegorz Kulewski <gk at leniwiec.biz>
> To: nginx at nginx.org
> Cc: Thomas Ward <teward at thomas-ward.net>, bouvierh
>         <nginx-forum at forum.nginx.org>
> Subject: Re: How to install nginx-module-njs on alpine
> Message-ID: <18f1f88f-6140-c099-09a7-1b2de8ad57c6 at leniwiec.biz>
> Content-Type: text/plain; charset=utf-8
>
> W dniu 02.06.2021 o?22:34, Thomas Ward pisze:
> > More than likely you'll have to compile the module yourself - I don't
> know of any distribution that currently ships the njs module.
>
> Gentoo ships njs with nginx.
>
> --
> Grzegorz Kulewski
>
>
>
> ------------------------------
>
> Message: 6
> Date: Wed, 2 Jun 2021 23:41:38 +0300
> From: "Sergey A. Osokin" <osa at freebsd.org.ru>
> To: nginx at nginx.org
> Subject: Re: How to install nginx-module-njs on alpine
> Message-ID: <YLftAtEsK0tB8Yj1 at FreeBSD.org.ru>
> Content-Type: text/plain; charset=utf-8
>
> Hi Hugues,
>
> On Wed, Jun 02, 2021 at 03:15:16PM -0400, bouvierh wrote:
> > Hello,
> >
> > How do I install the javascript module on Alpine? I have tried: "apk add
> > nginx-module-njs" but that module is not available.
> > ERROR: unable to select packages:
> >   nginx-module-njs (no such package):
>
> Could you try:
>
> % sudo apk add nginx-module-njs at nginx
>
> as it was described at https://nginx.org/ru/linux_packages.html#Alpine
> page.
>
> --
> Sergey Osokin
>
>
> ------------------------------
>
> Message: 7
> Date: Wed, 2 Jun 2021 23:44:53 +0300
> From: "Sergey A. Osokin" <osa at freebsd.org.ru>
> To: nginx at nginx.org
> Subject: Re: How to install nginx-module-njs on alpine
> Message-ID: <YLftxfbqUbPaVXoA at FreeBSD.org.ru>
> Content-Type: text/plain; charset=utf-8
>
> On Wed, Jun 02, 2021 at 11:41:38PM +0300, Sergey A. Osokin wrote:
> > Hi Hugues,
> >
> > On Wed, Jun 02, 2021 at 03:15:16PM -0400, bouvierh wrote:
> > > Hello,
> > >
> > > How do I install the javascript module on Alpine? I have tried: "apk
> add
> > > nginx-module-njs" but that module is not available.
> > > ERROR: unable to select packages:
> > >   nginx-module-njs (no such package):
> >
> > Could you try:
> >
> > % sudo apk add nginx-module-njs at nginx
>
> English page is here, https://nginx.org/en/linux_packages.html#Alpine
>
> --
> Sergey Osokin
>
>
> ------------------------------
>
> Message: 8
> Date: Wed, 2 Jun 2021 21:17:21 +0000
> From: TBD TBD <piersh at hotmail.com>
> To: "nginx at nginx.org" <nginx at nginx.org>
> Subject: RE: Partial cached fastsgi responses?
> Message-ID:
>         <
> BYAPR07MB637615D8948EAFD8DB8EEC9DDA3D9 at BYAPR07MB6376.namprd07.prod.outlook.com
> >
>
> Content-Type: text/plain; charset="windows-1252"
>
> I guess a related question is: is it possible for nginx to serve partial
> requests for cached fastcgi responses that don?t support ranges?
>
> Ie. Can the fastcgi module fetch the whole response from upstream, cache
> it, and then serve partial requests from the cache?
>
>
> From: TBD TBD<mailto:piersh at hotmail.com>
> Sent: Wednesday, June 2, 2021 12:28 PM
> To: nginx at nginx.org<mailto:nginx at nginx.org>
> Subject: Partial cached fastsgi responses?
>
> Is it possible to use the ?Range: bytes=? header with cached fastcgi
> locations? What config option do I need to use to get a cached fastcgi
> response to contain an `Accept-Ranges` header?
>
> Does the `fastcgi_force_ranges` config option even do anything?
>
> Piers.
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mailman.nginx.org/pipermail/nginx/attachments/20210602/426e84b2/attachment.htm
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
> ------------------------------
>
> End of nginx Digest, Vol 140, Issue 3
> *************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20210606/f0dec5cb/attachment-0001.htm>


More information about the nginx mailing list