Error directive help with 404

Hi all,
I’ve just moved from an apache2 server and i’m trying to set up nginx.

Its installed, compiled from source and running fine.
In the process of fine tuning my setup i noticed my 404’s aren’t doing
what i want.

I have my wordpress blog setup with php-fpm for php

when a 404 happens on a file with .html or /no-existent-url
the 404 does what i expect and wordpress handles it with my custom page.

if i enter domain.com/somepage.php i get the nasty default page that
browsers server.
in I.E especially

my server config looks like this

server {
    listen       80;
    server_name  www.domain.com;

       try_files $uri $uri/ /index.php?q=$uri&$args;
    #error_page 404  /index.php?error=404;
    location / {
        root  /usr/share/nginx/html;
        index  index.html index.htm index.php;
    if (!-e $request_filename) {
    rewrite ^ /index.php last;
    }
    error_page  404              /swf/404.php;
  location = /swf/404.php {
    root   /usr/share/nginx/html;
  }


    }

I’ve searched about and found examples of the error_page directive being
used not specifically for a 404 but i assumed its the same.
It doesn’t seem to work though.
Can anyone help me please?

Posted at Nginx Forum:

Hello!

On Fri, May 28, 2010 at 06:23:13PM -0400, robinsonc494 wrote:

if i enter domain.com/somepage.php i get the nasty default page that browsers server.
in I.E especially

So you have 404 returned from php, and it’s returned to browser as
is. Use fastcgi_intercept_errors to intercept backend errors, see
here:

http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_intercept_errors

Maxim D.

Hi,
thanks for responding.
i tried that but then i get “no input file specified”
I’m using php-fpm not fastcgi if that makes a difference…

thanks

Posted at Nginx Forum: