zrtlin 2014-03-04
之前参考了不少文件,配置均不生效。
过程(ubuntu):
1.到nginx安装目录新建一个404.html /usr/share/nginx/html
2.到各server节点下新增404处理逻辑
vim /etc/nginx/sites-enabled/default
server { listen 80 ; server_name m.xx.com; root /var/www/m; index m.html; error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } }
误解一, 要vim /etc/nginx/nginx.conf ,在http块加fastcgi_intercept_errors参数
http { #fastcgi_intercept_errors on;
This module allows Nginx to interact with FastCGI processes and control what parameters are passed to the process.
这个模块仅对fastcgi生效,yes就是说纯html的跳转,其实不加这个参数即可。