Log Of Attempted Files

I
  • 22 Feb '23
dear nginx experts --- If I use an alias in my location, then
$realpath shows in my log file what file was actually served up.
Great.

How can I show in the access log file what file(s) nginx tried?  I do
not want the full rewrite engine in the debug log --- it contains way
too many things I do not understand and way too few things I do [or,
equivalently, I am just much too clueless].  I would ideally want just
to see something like

/var/www/html/index.html not found
/var/www/html/index.htm not found
/var/www/html/index-debian.htm OK

Short of this, what is the $variable name for the last file for the
log format in nginx?  pointer(s) appreciated.
M
  • 23 Feb '23
Hello!

On Wed, Feb 22, 2023 at 02:39:36PM -0800, Ivo Welch wrote:

> dear nginx experts --- If I use an alias in my location, then
> $realpath shows in my log file what file was actually served up.
> Great.

There is no $realpath variable in nginx.

The $request_filename variable identifies the file being served 
(or going to be served) based on URI and root/alias directives in 
effect, see http://nginx.org/r/$request_filename.

> How can I show in the access log file what file(s) nginx tried?  I do
> not want the full rewrite engine in the debug log --- it contains way
> too many things I do not understand and way too few things I do [or,
> equivalently, I am just much too clueless].  I would ideally want just
> to see something like
> 
> /var/www/html/index.html not found
> /var/www/html/index.htm not found
> /var/www/html/index-debian.htm OK
> 
> Short of this, what is the $variable name for the last file for the
> log format in nginx?  pointer(s) appreciated.

I don't think it's possible to obtain such a list of files in a 
variable.

-- 
Maxim Dounin
http://mdounin.ru/