简体   繁体   English

Angular 6 angular.json 在配置中添加 ssl

[英]Angular 6 angular.json add ssl in configuration

I want to serve my application though SSL previously I had this script:我想通过 SSL 为我的应用程序提供服务,之前我有这个脚本:

ng serve --ssl --ssl-key "pathtokey\key.crt"

I want to add SSL in the new angular.json but when i try to add it i got the error:我想在新的 angular.json 中添加 SSL,但是当我尝试添加它时出现错误:

Schema validation failed with the following errors:
 Data path "" should NOT have additional properties(ssl).

What is the proper way to use SSL with angular cli 6?在 angular cli 6 中使用 SSL 的正确方法是什么?

In angular.json:在 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 REQUIRES YOU TO DEFINE THE PARAMS: --ssl-key & --ssl-cert Angular 6 要求您定义参数:-- ssl-key & --ssl-cert

Create or get trusted certificate key and cert files and place it in C:\\certificates\\创建或获取受信任的证书密钥和证书文件并将其放置在 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM