要求:
访问http://www.qq.com/123 url保持不变  显示的结果为指定的404页面
curl -I  http://www.qq.com/123  返回的状态码为404
准备一 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即可。