Angular 18+ 高级教程 – Angular Configuration (angular.json)

前言

记入一些基本的配置。

 

Setup IP Address、SSL、Self-signed Certificate

如果你对 IP Address、SSL、Self-signed Certification 不熟悉,请看这篇先 Vs Code, Visual Studio 2022, Angular and Live Server Running Through Https and IP Address

在 angular.json 添加设置

"options": {
  "host": "192.168.1.152",
  "port": 4200,
  "ssl": true,
  "sslKey": "C:\\self-signed-certificate\\192.168.1.152.key",
  "sslCert": "C:\\self-signed-certificate\\192.168.1.152.crt"
},
View Code

或者在启动 command 加上 parameters

ng serve --open --host=192.168.1.152 --port=4200 --ssl --ssl-key=C:\\self-signed-certificate\\192.168.1.152.key --ssl-cert=C:\\self-signed-certificate\\192.168.1.152.crt

 

posted @ 2024-02-02 18:30  兴杰  阅读(151)  评论(0编辑  收藏  举报