zoukankan      html  css  js  c++  java
  • [Angular] Run Angular CLI with https

    Generate a certificate

    git clone https://github.com/RubenVermeulen/generate-trusted-ssl-certificate.git 
    cd generate-trusted-ssl-certificate

    bash generate.sh

    You should now have a server.crt and a server.key file in the repository folder.

    Install the certificate (MacOS)

    1. Double click on the certificate (server.crt)
    2. Select your desired keychain (login should suffice)
    3. Add the certificate
    4. Open Keychain Access if it isn’t already open
    5. You should see the certificate localhost, double click it
    6. Expand Trust tab
    7. Select the option Always Trust in When using this certificate
    8. Close the certificate window

    Configure the application

    create a ssl folder in applciation

    angular-app:
       - e2e
       - src
       - ssl
       .angular-cli.json

    Copy the private key and root certificate from step 1 into the ssl folder. Make sure the file names are like this:

    server.key (private key)
    server.crt (root certificate)

    Update package.json:

    "start": "ng serve --ssl --ssl-key ./ssl/server.key --ssl-cert ./ssl/server.crt",

    Run:

    npm start
  • 相关阅读:
    JAVA EE企业级开发四步走
    区间dp笔记√
    TYVJ P1016 装箱问题
    树状数组的笔记√(hzwer blog)
    忠诚//线段树
    线段树笔记√
    P1005 采药
    超级书架【未完】
    P1082 找朋友
    数字三角形系列
  • 原文地址:https://www.cnblogs.com/Answer1215/p/12380393.html
Copyright © 2011-2022 走看看