系统相关
首页 > 系统相关> > nginx 该报502错误确显示404

nginx 该报502错误确显示404

作者:互联网

现象

nginx转发后端服务报错,应是502,但是返回值却是404

分析

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

解决

测试

server {
    listen       80;
    server_name  web80;
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        add_header Cache-Control no-store;
    }
        # 写一个location,转发给不存在的页面。
        location /test/ {
          proxy_pass http://127.0.0.1:82/;
        }


    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}

image.png

image.png

标签:html,nginx,404,location,50x,502
来源: https://blog.csdn.net/xingzuo_1840/article/details/120315736