displaying standard 404 page, if php file is not found

Nuno Magalhães nunomagalhaes at eu.ipp.pt
Wed Jul 29 18:57:41 MSD 2009


Here's mine. Don't know about that try-files thing, this one works for
me. Any nonexistent files get my 404 page.

	error_page  404  /40x.html;
	location = /40x.html {
		root   /var/www/nginx-default;
	}
	location ~ \.(php|html)$ {
		fastcgi_pass   localhost:9000;
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
		fastcgi_param DOCUMENT_ROOT /var/www/nginx-default;
		fastcgi_intercept_errors on;
		include fastcgi_params;
	}

You should use absolute paths though...

HTH

-- 
()  ascii-rubanda kampajno - kontraŭ html-a retpoŝto
/\  ascii ribbon campaign - against html e-mail





More information about the nginx mailing list