Nginx的一个404设置方法

之前,以为Nginx像IIS和apache一样,可以指定404的设置,但一直没有找到,今天通过google等发现,可以利用Rewrite来写404的设置。

error_page 404 http://www.xx.com/page-error;

location /page-error {
rewrite ^(.*) http://www.xx.com/?page-error.html permanent;

}

This entry was posted in Nginx and tagged , . Bookmark the permalink.

One Response to Nginx的一个404设置方法

  1. Pingback: 终于松口气了 | 两耳失聪,落叶无声

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>