http-server启动https服务(mac)

首先在终端上生成密钥文件

openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem

其次,指定密钥文件

$ http-server -S -C cert.pem -o
Starting up http-server, serving ./ through https
Available on:
  https:127.0.0.1:8080
  https:192.168.1.101:8080
  https:192.168.1.104:8080
Hit CTRL-C to stop the server

参考:https://stackoverflow.com/questions/35127383/npm-http-server-with-ssl

你可能感兴趣的:(http-server启动https服务(mac))