【问题标题】:404 Not Found page nginx / 1.18.0404 未找到页面 nginx / 1.18.0
【发布时间】:2020-12-02 00:09:20
【问题描述】:

重新加载404 Not Found页面时出错 nginx / 1.18.0

如果您在链接中添加 # 符号

示例http://127.0.0.1:8080/#/url_page 然后进行转换/如何修复它?

server {
    listen       80;
    server_name  localhost;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        rewrite ^/([^\.]+)$ /$1 break;
        add_header 'Access-Control-Allow-Origin' 'http://${BACKEND_ADDR}:${BACKEND_PORT}';
    }

    location /api/v1 {
        proxy_pass   http://${BACKEND_ADDR}:${BACKEND_PORT};
        proxy_http_version 1.1;
        client_max_body_size 100M;
    }


    location /api/v1/ws/ {
        proxy_pass http://${BACKEND_ADDR}:${BACKEND_PORT};
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

【问题讨论】:

    标签: vue.js nginx


    【解决方案1】:

    url 中的片段标识符不会发送到 nginx。只需将根目录转发到后端即可。

    【讨论】:

    • 请举个例子
    猜你喜欢
    • 1970-01-01
    • 2020-01-04
    • 2014-09-12
    • 1970-01-01
    • 1970-01-01
    • 2015-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多