文章内容

2019/9/4 19:12:55,作 者: 黄兵

Angular nginx 404解决方案

最近把Angular程序部署到服务器,但是通过Url访问,出现404错误,具体如下:

解决方案:

修改Nginx的配置文件:

location / {
            # First attempt to serve request as file, then
            # as directory, then redirect to index(angular) if no file found.
            try_files $uri $uri/ /index.html;
    }

即可解决问题。


参考资料:

1、404 Not Found nginx angular routing

2、nginx 配置location详解


黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - Angular nginx 404解决方案

分享到:

发表评论

评论列表