404 not showing up in error logs (for PHP files)

Hi All,

When a user enters an invalid php file name they are correctly routed to
our default 404.html:

try_files $fastcgi_script_name =404;

The problem is that the 404 error is not showing up in our error logs.

Other 404 errors do show up in our system.

Please advise.

Thanks!

Have you tried

fastcgi_intercept_errors on;

?

----- Original Message -----
From: Ilan B.
To: [email protected]
Sent: Thursday, January 05, 2012 6:05 PM
Subject: 404 not showing up in error logs (for PHP files)

Hi All,

When a user enters an invalid php file name they are correctly routed to
our
default 404.html:

try_files $fastcgi_script_name =404;

The problem is that the 404 error is not showing up in our error logs.

Other 404 errors do show up in our system.

Please advise.

Thanks!


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

On Thu, Jan 05, 2012 at 12:05:36PM -0500, Ilan B. wrote:

Hi there,

When a user enters an invalid php file name they are correctly routed to
our default 404.html:

try_files $fastcgi_script_name =404;

The problem is that the 404 error is not showing up in our error logs.

Other 404 errors do show up in our system.

I don’t see any 404s in error.log, and I do see all 404s in access.log.

Is that different from what you see, or different from what you expect?

(I do see in error.log where the nginx static file handler logs when it
fails to open an expected file; but that’s distinct from 404 logging.)

f

Francis D. [email protected]

I haven’t checked the access logs yet (we have them turned off for now).
I’m just working through various errors, but I understand what you’re
saying. I’ll turn the access logs on and see if I see it in there (I’m
sure I will).

Also thanks to Falko pointing me to the error intercept option, although
it
may not be necessary at this time.

Ilan

On Thu, Jan 5, 2012 at 6:32 PM, Francis D. [email protected] wrote:


Francis D. [email protected]


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Ilan B.
Chief Technology Officer
Time4Learning.com

6300 NE 1st Ave., Suite 203
Ft. Lauderdale, FL 33334
(954) 771-0914

http://www.twitter.com/time4learning
http://www.facebook.com/Time4Learning

Time4Learning.com - Online interactive curriculum for home use, PreK-8th
Grade.
Time4Writing.com - Online writing tutorials for high, middle, and
elementary school students.
Time4Learning.net - A forum to chat with parents online about kids,
education, parenting and more.
spellingcity.com - Online vocabulary and spelling activities for
teachers,
parents and students.

Hello!

On Thu, Jan 05, 2012 at 12:05:36PM -0500, Ilan B. wrote:

Please advise.

This is expected behaviour. The “try_files” directives checks
files as configured and uses configured fallback if there are no
files found. It is not expected to log anything to error log
if there are no files found.

Maxim D.

We solved this problem like this:

try_files $uri $uri-404;

This would first check if the php file exists, and if not it would try
to
open that same php file but with “-404” appended to it, so the user
would
still get a 404 status code, but it would also log what file was called.
I
hope this helps.

P.S. Sorry for replying to this topic 2 years later, but this is one of
the
topics that come out when you search for this issue and I think it is
usefull that there is an easy solution.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220849,247357#msg-247357

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs