LoginSignup
0
0

[個人メモ]macでhttpsサーバーを作成する

Last updated at Posted at 2024-02-19

業務でちょっとしたテストをするときに便利なのでメモ書き

順序としては以下のとおり

  • サーバーを建てるデイレクトリの作成
  • やりたいことによるがファイル等の準備
  • hostsファイルを編集して使用してドメインをローカル(127.0.0.1)に向ける
  • https通信をしたいので自前で証明書と鍵の作成をする
  • 以下のコマンドを↑で作成したディレクトリに行き実行する
serve -s -l 443 -C  --ssl-cert local.crt --ssl-key local.key

コマンドの解説

  • -l 443
    listening portの指定、Https通信をするので443(Well-known port)を指定する
  • -C
    CORSの許可をする
  • --ssl-cert, --ssl-key
    使用する証明書と鍵の指定をする

参考にした記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0