浏览器路由 浏览器刷新,页面404,依靠nginx配置解决

2022-07-14  本文已影响0人  日不落000

        location ^~/powervischart/static/ {
            alias  /usr/local/webserver/nginx/html/static/;
        }

        location ~* \.(gif|jpg|png|js|css|ttf|woff|woff2)$ {
          #  root  /usr/local/webserver/nginx/html/;
        }

        location /powervischart/ {
            root /usr/local/webserver/nginx/html/;
            # autoindex on;
            index index.html index.htm;
            try_files $uri $uri/ /index.html;
        }

        location / {
             root   /usr/local/webserver/nginx/html/;
             index  index.html index.htm;
             try_files $uri $uri/ /index.html;
        }

参考:
nginx 适配react-router browserRoute 路由问题使用教程

Nginx之location详解

nginx找不到静态(css,js,html)文件404报错,root的解析

上一篇 下一篇

猜你喜欢

热点阅读