Skip to content

Instantly share code, notes, and snippets.

@lukewang1024
Created February 14, 2019 07:17
Show Gist options
  • Select an option

  • Save lukewang1024/9216576b27f66dbb8e6fd1e01601ab92 to your computer and use it in GitHub Desktop.

Select an option

Save lukewang1024/9216576b27f66dbb8e6fd1e01601ab92 to your computer and use it in GitHub Desktop.
Use http-server to host with SSL
> mkdir -p ~/.cert; cd ~/.cert
> openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
Generating a 2048 bit RSA private key
...............................+++
..................................................................+++
writing new private key to 'key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) []:.
State or Province Name (full name) []:.
Locality Name (eg, city) []:.
Organization Name (eg, company) []:.
Organizational Unit Name (eg, section) []:.
Common Name (eg, fully qualified host name) []:.
Email Address []:[email protected]

> http-server -S -C ~/.cert/cert.pem -K ~/.cert/key.pem
Starting up http-server, serving ./ through https
Available on:
  https://127.0.0.1:8080
Hit CTRL-C to stop the server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment