Welcome! Log In Create A New Profile

Advanced

Re: serving files from /proc

Francis Daly
December 12, 2023 12:44PM
On Tue, Dec 12, 2023 at 04:17:11PM +0100, Jérôme Loyet wrote:

Hi there,

> I'm trying to serve some files from /proc but nginx return a 0 bytes
> content because the file size of many files in /proc/ tree is simply 0 by
> design.

I suspect that you are going to have to write something to read the file
and tell nginx what the "real" size and content is.

Stock nginx knows that for static files, when the filesystem says that
st_size is 0, the file has a size of 0. That happens to not be true for
some things within /proc; so either you get to change the code behind
/proc to return "real" values, or you get to write something to return
real values.

I guess it will be simpler to run something like a fastcgi process that
will "cat" the file, and tell nginx to fastcgi_pass to that process for
these requests; than to rewrite the /proc code or to rewrite the nginx
static file handler to do extra things when it is told that the size is 0.

> is there a simple way to configure nginx to return the cotent of
> /proc/net/route or any other file in /proc ?

Untested, but I suspect "directly: no; indirectly, maybe (as above)".

Cheers,

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

serving files from /proc

Jérôme Loyet December 12, 2023 10:18AM

Re: serving files from /proc

Francis Daly December 12, 2023 12:44PM

Re: serving files from /proc

J Carter December 12, 2023 09:48PM

Re: serving files from /proc

J Carter December 12, 2023 10:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 136
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready