Please help me get FastCGI working with nginx

Rob Schultz rschultz7 at gmail.com
Tue Aug 5 07:00:57 MSD 2008


I currently do this in my location block
location ~ .*\.php$ {
       if (!-f $request_filename) {
                return 404;
       }
       fastcgi_pass   127.0.0.1:9000;
       fastcgi_index   index.php;
}

This way when it goes to process the php files if it is not found then
returns a 404 instead of passing it onto php and getting the no input file
error.


On Mon, Aug 4, 2008 at 8:06 PM, Rt Ibmer <rtibmx at yahoo.com> wrote:

> > purposely request a PHP page that doesn't exist (as a
> > test) the browser returns "No input file
> > specified." instead of the standard 404 page?
> >
> > You need
> >     fastcgi_intercept_errors  on;
>
> Thanks. I did that, but then had to also use the error_page directive to
> point it at my 404.php page.
>
> However this has the undesirable effect of then changing the URL in the
> browser to 404.php.
>
> Is there a way I can have nginx return the content of my 404.php page as
> the output, so the user still sees their bad page in the URL (i.e.
> http://www.mysite.com/badpage.php instead of http://www.mysite.com/404.php
> )?
>
> Thank you.
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080804/8d8db337/attachment.html>


More information about the nginx mailing list