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