Nginx配置404错误页面跳转

2022-10-31 15:57:38 浏览数 (1)

代码语言:javascript复制
server{
        listen 80;
        server_name www.itze.cn;
        index index.html;
        root /nginx/html/web;

        location / {
                root   html;
                index  index.html index.htm;

                proxy_intercept_errors on;     #开启拦截404等错误
        }

        #配置错误页面跳转
        error_page 404  /404.html;
            location =  /404.html {
            root /nginx/error;   #这里是404文件所在目录的绝对路径!!!
        }

}

0 人点赞