The website written five years ago was the error page written under apache. After nginx was changed, the 404 page directly jumped to the internal error of the 500 server.
You only need to configure
Specify try_files.
Debian, in/etc/nginx/site-available/default, location/
Server {
</pre><pre name="code" class="plain">location / { <span style="white-space:pre"></span>try_files $uri $uri/ /error/404.php?c=404 =404; <span style="white-space:pre"></span>}
<pre name="code" class="plain"><span style="white-space:pre"></span>error_page 403 /error/403.php;<span style="white-space:pre"></span>error_page 404 /error/404.php;<span style="white-space:pre"></span>error_page 500 501 502 503 504 /error/500.php;
}
Then reload nginx.
Reference http://wiki.nginx.org/HttpCoreModule#try_files
Note: I put the page under the error folder under the website directory. For example, if the website is placed on the/var/www/error page, it is in/var/www/error/403.php...
The test is very simple. 403 does not have the permission, for example, your website directory css directory, image directory or something. 404 does not exist. You can just enter an address. 500 is on the server, here I will stop php-fpm for testing. the effect is as follows: