Welcome! Log In Create A New Profile

Advanced

Re: 404 instead of "no inout file specified"?

Leechael Yim
July 07, 2009 01:47PM
if (-f $request_filename) { fastcgi_pass 127.0.0.1:9000;
}


OR:


if (!-f $request_filename) {
return 404;
}
fastcgi_pass 127.0.0.1:9000;


The first one is what I current used with my Nginx.

On Wed, Jul 1, 2009 at 10:20 PM, Maxim Dounin wrote:

> Hello!
>
> On Wed, Jul 01, 2009 at 02:52:06PM +0100, Nuno Magalhães wrote:
>
> > Greetings,
> >
> > If i provide a valid URL, it's processed.
> > If i provide an invalid URL, nginx shows the 404 page except it the
> > invalid URL ends in .php - in that case i get the "no input file
> > specified" message.
>
> Looks like you've configured passing urls ending with ".php" to
> php for processing. So you got errors from php, not from nginx.
> It's expected behaviour, no?
>
> And, actually, "no input file specified" *is* 404 error. It's
> just has some fancy php-specific content.
>
> > I'm in the process of changing my php files to an html extension (i
> > assume that would "fix" things), however, i'd like to get a 404
> > instead of the message regardless.
> >
> > I tried using "fastcgi_intercept_errors off" in the conf for my server
> > (in sites-available), but it didn't do anything (i did restart both
> > nginx and the fast-cgi processes).
> >
> > Is there a better way?
>
> If you want to change error page returned by php to something
> pretty-looking, you should:
>
> 1. Use "fastcgi_intercept_errors on;" to instruct nginx to
> intercept and change errors returned by fastcgi application.
>
> 2. Make sure you explicitly configured error_page for 404.
> Default compiled-in error pages are used only for nginx own
> errors, not for fastcgi_intercept_errors/proxy_intercept_errors.
>
> So your resulting config should look like:
>
> error_page 404 /404.html;
>
> location ~ \.php$ {
> fastcgi_pass ...;
> fastcgi_intercept_errors on;
> }
>
> ...
>
> Maxim Dounin
>
>


--
Twitter: http://www.twitter.com/leechael
Subject Author Posted

404 instead of "no inout file specified"?

Nuno Magalhães July 01, 2009 09:52AM

Re: 404 instead of "no inout file specified"?

Roxis July 01, 2009 10:01AM

Re: 404 instead of "no inout file specified"?

Maxim Dounin July 01, 2009 10:20AM

Re: 404 instead of "no inout file specified"?

Leechael Yim July 07, 2009 01:47PM

Re: 404 instead of "no inout file specified"?

edogawaconan July 07, 2009 02:09PM

Re: 404 instead of "no inout file specified"?

Leechael Yim July 07, 2009 02:30PM

Re: 404 instead of "no inout file specified"?

Maxim Dounin July 07, 2009 03:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
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