9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

peerjs-serverでSignalingをSSL化する.

Last updated at Posted at 2015-02-18

自前のSingalingシグナリングサーバをSSL対応にする場合,
SSL証明書の設定が必要になる.

オレオレ証明書でサーバを建てた時の手順を示す.

環境

  • CentOS 6.6
  • node.jsインストール済み

SSL証明書の生成

#openssl genrsa 2048 > server.key
#openssl req -new -key server.key > server.csr
#openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt
#mkdir /home/your/ssl/
#mv server.key server.csr /home/your/ssl/

peerjs-server

  • ダウンロード
    GitHubから最新版をダウンロードする.

peerjs-server
=> Download ZIP

  • deploy

解凍したファイルを格納する.

/home/your/path/peerjs-server-master

npmパッケージをインストールする.

$cd /home/your/path/peerjs-server-master
$npm install
  • SSLの設定

SSLオプションを指定した場合,SSL証明書を読み込むようにする.

/home/your/path/peerjs-server-master/bin/peerjs
<       key: fs.readFileSync('/home/your/ssl/server.key'),
<       cert: fs.readFileSync('/home/your/ssl/server.crt')
---
>       key: fs.readFileSync(path.resolve(opts.sslkey)),
>       cert: fs.readFileSync(path.resolve(opts.sslcert))
  • 起動
$ cd /home/your/path/peerjs-server-master/
$ $node bin/peerjs -k peerjs -p 9000 --sslkey --sslcert -d 

Signalingサーバへのアクセスが wss:// になっていれば成功.

9
6
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
9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?