websocket启动后报错
// 证书最好是申请的证书
$context = array(
// 更多ssl选项请参考手册 http://php.net/manual/zh/context.ssl.php
'ssl' => array(
// 请使用绝对路径
'local_cert' => '/home/elinkSSL/wxwss.iloveismarthome.com/wxwss.pem', // 也可以是crt文件
'local_pk' => '/home/elinkSSL/wxwss.iloveismarthome.com/wxwss.key',
'verify_peer' => false,
// 'allow_self_signed' => true, //如果是自签名证书需要开启此选项
)
);
// websocket协议(端口任意,只要没有被其它程序占用就行)
$gateway = new Gateway("websocket://0.0.0.0:8871",$context);
// 开启SSL,websocket+SSL 即wss
$gateway->transport = 'ssl';
ssl root wss-lock-prod websocket://0.0.0.0:8871 10 [OK]
-------------------------------------------------------------------------------------------------------
Press Ctrl+C to stop. Start success.
SSL handshake error: stream_socket_enable_crypto(): SSL: Success
SSL handshake error: stream_socket_enable_crypto(): SSL: Success
SSL handshake error: stream_socket_enable_crypto(): SSL: Success
SSL handshake error: stream_socket_enable_crypto(): SSL: Success
workerman v 3.5.29 php 7.2.34
如果你解决不了就直接用nginx代理
nginx代理如何写?
参考手册 https://www.workerman.net/doc/workerman/faq/secure-websocket-server.html#nginx%E9%85%8D%E7%BD%AE%E5%8F%82%E8%80%83