FastCGI returning "No Input File" instead of 404

Michael Shadle mike503 at gmail.com
Thu May 21 20:32:50 MSD 2009


i was going to say this is the typical "check your SCRIPT_FILENAME"
but you already know that.

this is an interesting question. Igor would it be possible to
intercept this (or with a combination from php-fpm/the SAPI) to detect
these errors and present the 404 (or appropriate) handler defined?
either nginx default 404 or in the case of error_page being set using
that one (like a normal file-does-not-exist.html)

[root at web01 ~]# lynx -mime_header http://foo.com/script-doesnt-exist.php
HTTP/1.0 404 Not Found
Server: nginx
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Content-Encoding: gzip
Date: Thu, 21 May 2009 16:32:12 GMT
Content-Length: 45
Connection: close

it appears to throw a 404, but for some reason isn't the normal nginx 404?

On Thu, May 21, 2009 at 9:25 AM, APseudoUtopia <apseudoutopia at gmail.com> wrote:
> Hey everyone,
>
> This seems like it would be easily solved, but I'm not sure how. I
> just finished setting up PHP on my system. It runs fine. However, when
> I browse to a page like
> "http://domain.com/this-php-script-does-not-exist.php" it returns "No
> input file specified" instead of a normal nginx 404 error. I'm trying
> to get it to display a normal 404 error instead. I've tried toggling
> the fastcgi_intercept_errors, which seems like it would fix the
> problem, however it didn't work.
>
> I'm running nginx stable, 0.6.37.
>
> It seems that try_files would work somehow, but my understanding is
> that try_files does not exist in 0.6.37?
>
> My FastCGI config is below.
>
> location ~ .*\.php$ {
>        fastcgi_index index.php;
>        fastcgi_ignore_client_abort off;
>        fastcgi_intercept_errors off;
>        fastcgi_pass 127.0.0.1:9000;
>        fastcgi_read_timeout 10; # sec to wait for php-cgi to return data
>        fastcgi_param SCRIPT_FILENAME /usr/local/www/web_root$fastcgi_script_name;
>        include /usr/local/etc/nginx/fastcgi_params;
> }
>
> Thank you for any and all help.
>
>





More information about the nginx mailing list