server_name .site.com; root /var/www/site.com; error_page 404 /404.php; access_log /var/log/nginx/site.access.log; index index.html index.php;
if ($http_host != "www.site.com") { rewrite ^ http://www.site.com$request_uri permanent; } location ~* \.php$ { # try_files $uri = 404; fastcgi_index index.php; fastcgi_pass 127.0.0.1:xxxx; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_read_timeout 240; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_param SCRIPT_NAME $fastcgi_script_name; } after adding error_page 404 /404.php it works for other files which are not php. It calls the error page. But if it is a php file, it shows "File not found." Posted at Nginx Forum: http://forum.nginx.org/read.php?2,243869,243870#msg-243870 _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx