![](/img/trans.png)
[英]What is the right way to add an environment configuration to angular.json?
[英]Angular 6 angular.json add ssl in configuration
我想通過 SSL 為我的應用程序提供服務,之前我有這個腳本:
ng serve --ssl --ssl-key "pathtokey\key.crt"
我想在新的 angular.json 中添加 SSL,但是當我嘗試添加它時出現錯誤:
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(ssl).
在 angular cli 6 中使用 SSL 的正確方法是什么?
在 angular.json 中:
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build",
"ssl": true,
"sslKey": "path to .key",
"sslCert": "path to .crt"
},
...
}
Angular 6 要求您定義參數:-- ssl-key & --ssl-cert
創建或獲取受信任的證書密鑰和證書文件並將其放置在 C:\\certificates\\
ng serve --ssl --ssl-key c:\\certificates\\server.key --ssl-cert c:\\certificates\\server.crt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.