要求:
准备一 404.php页面在最底部加上:
<?php
@header('HTTP/1.1 404 Not Found');
@header('Status: 404 Not Found');
?>
然后nginx里配置
location / {
xxxxx; ##此处表示N多的规则依据实际情况定##
rewrite ^/404.html /404.php last;
if (!-e $request_filename) {
rewrite ^(.*)$ /404.html last;
}
}
然后reload nginx即可。
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/592247