error directive help with 404

robinsonc494 nginx-forum at nginx.us
Sat May 29 02:23:13 MSD 2010


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: http://forum.nginx.org/read.php?2,91680,91680#msg-91680




More information about the nginx mailing list