How to get wordpress to handle error pages instead of nginx?

I used to have this working but today I realized it was no longer working and I have no idea what changed.

I have this directive in my config file for a specific wp site:

error_page 404 = @wordpress;   

and this one:

fastcgi_intercept_errors off;   

any ideas?

I'd like to see Wp handle the error page instead of nginx saying simply: 404 Not Found

Can you please post your nginx config here?

Specially location / {…} block.

Or you can simply try using an updated config from this list.

nginx.conf

user www-data;  
worker_processes 4;  
pid /var/run/nginx.pid;  
events {  
  worker_connections 1024;  
  #multi_accept on;  
}  

http {  
  # Basic Settings  
  sendfile on;  
  tcp_nopush on;  
  tcp_nodelay on;  
  keepalive_timeout 10 10;  
  types_hash_max_size 2048;  
  client_max_body_size 16m;  
  server_tokens off;  
  index index.php index.html index.htm;    

include /etc/nginx/mime.types;  
  default_type application/octet-stream;  

# Logging Settings  
  access_log /var/log/nginx/access.log;  
  error_log /var/log/nginx/error.log;  

# Gzip Settings  
  gzip on;  
  gzip_disable "MSIE [1-6].(?!.*SV1)";  
  gzip_vary on;  
  gzip_proxied any;  
  #gzip_comp_level 6;  
  gzip_buffers 16 8k;  
  #gzip_http_version 1.0;  
  gzip_http_version 1.1;  
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;  

# Virtual Host Configs  

include /etc/nginx/conf.d/*.conf;  
  include /etc/nginx/sites-enabled/*;  
}  

Sample virtual host conf:

server {  
    server_name knightsenglish.com www.knightsenglish.com;  
    root /var/www/knightsenglish.com;  
    include /etc/nginx/php.conf;  
    include /var/www/knightsenglish.com/nginx.conf;  
    error_page 404 = @wordpress;  
location / {  
   try_files $uri $uri/ /index.php?q=$uri&$args;  
}  

#use fastcgi for all php files  
location ~ .php$  
{  
    try_files $uri @wordpress;  
    fastcgi_index index.php;  
    fastcgi_pass 127.0.0.1:9000;  
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
    include fastcgi_params;  
}  
location @wordpress {  
    fastcgi_pass 127.0.0.1:9000;  
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;  
    #fastcgi_index index.php;  

    #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
    include fastcgi_params;  
    fastcgi_param SCRIPT_NAME /index.php;  
}  

#Browsers always look for a favicon, I rather not flood my logs      
location = /favicon.ico { access_log off; log_not_found off; }  

#Make sure you hide your .hidden linux/unix files      
location ~ /. { deny  all; access_log off; log_not_found off; }  

#caching static content for 7 days      
location ~* .(jpg|png|gif|jpeg|doc|xls|pdf)$ {  
        expires 7d;  
}  

#We want Wordpress to handle the error page  
fastcgi_intercept_errors off;  
}  

You don’t need to explicitly tell WordPress to handle 404. It does that by default.

Try removing extra codes: location @wordpress and error_page directive.

Also, fastcgi_intercept_errors remains off by default.

I will recommend using my config posted here - http://rtcamp.com/tutorials/installing-fresh-wordpress-nginx-minimal/

If you get that working, you can add any caching method on the top of it.