Ubuntu nginx 配置404错误页面

1.创建自己的404.html页面;

2.更改nginx.conf在http定义区域加入:

/etc/nginx# vim nginx.conf 下添加 fastcgi_intercept_errors on; 
 http{
    ......
    fastcgi_intercept_errors on; 
    ......
}

3.更改/etc/nginx/sites-enabled/default 文件

 #error_page 404 /404.html;
改为
 error_page 404 = /404.html; 或者 error_page 404 = http://www.xxx.com/404.html

4.测试nginx.conf正确性: nginx –t

5.重启nginx: nginx -s reload

posted @ 2015-07-04 01:43  独自上路  阅读(1629)  评论(0编辑  收藏  举报