我是angular2的新手。我一直在使用Nginx作为我的angular1。如何在angular2-cli中配置这些设置
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8080/cloudface/;
proxy_cookie_path /cloudface/ /;
答案 0 :(得分:2)
official documentation上提供了完整指南,介绍了在生产服务器上正确部署应用程序时需要了解的所有内容。甚至还有一部分专用于Nginx
配置。
我还建议您利用Angular-CLI来正确处理与bundling
,optimizing
和AOT compilation
相关的所有内容。
答案 1 :(得分:0)
Angular-Cli不适合生产。它是一个开发服务器。所以这些东西可能不需要设置在angular-cli中。对于后端代理,可以通过Setup Backend proxy
来实现{
"/api": {
"target": "http://localhost:3000",
"secure": false
}
}