header background image

5分でWindowsにhttps://localhost:8080を立ち上げる

2020年5月23日☕️ 1 min read

Service Workerをローカルでテストする場合、localhostでhttps化への手順の整理。

chocolateyのインストール

PowerShellを管理権限で起動し、下記のコマンドを実行してください。

run-powershell-admin.png

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

参考リンク:https://chocolatey.org/install

mkcertのインストール

choco install mkcert

証明書生成

mkcert localhost

http-serverでサーバを立ち上げる(nodejsが必要)

npm i -g http-server
http-server ./ -S -K ./localhost-key.pem -C ./localhost.pem

完了

https://localhost:8080/にアクセスできました。

サンプルプロジェクト

https://github.com/thundermiracle/try-scheduled-push

ThunderMiracle

Blog part of ThunderMiracle.com

コメントは表示領域に入ると読み込みます