angular 部署的问题

以前的经验

刚开始部署不太会,是在flask里面直接返回生成的文件,这样会有许多问题,不能处理路由,返回静态文件的性能不太好。

现在找到一个比较好的方法,在nginx里面设置

        location / {
            root   html;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html;   # 这一行是重点
        }



        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        location ~ /api/  {   # 转发api到后端
           proxy_pass   http://127.0.0.1:5000;
        }


右下角对话与我联系。


Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×