Fork me on GitHub

避免一些浏览器对错误404页面劫持的解决办法

1、修改nginx 配置

vim /etc/nginx/nginx.conf 

或修改同样有效的这个文件夹下的任意conf结尾的文件

vim /etc/nginx/conf.d/*.conf

2、将状态码进行修改,将404修改为200

server {
        server_name www.a.net;
        root /data/site1;
        location /about {
                root /opt/testdir/;
                index test.html;
        }
        error_page 404 =200 /404.html;
        location = /404.html {
        }
}
~           

 

posted @ 2021-05-31 15:10  Alex-Lzy  阅读(323)  评论(0编辑  收藏  举报