lnmp环境 php7.0
# php start.php start
Workerman start in DEBUG mode
----------------------- WORKERMAN -----------------------------
Workerman version:3.4.4 PHP version:7.0.21
------------------------ WORKERS -------------------------------
user worker listen processes status
root PHPSocketIO socketIO://0.0.0.0:2120 1
root WebServer http://xxxxxx:2123 1
----------------------------------------------------------------
Press Ctrl-C to quit. Start success.
PHP Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request in /home/wwwroot/xxxxxx/linuxSocket/vendor/workerman/workerman/Connection/TcpConnection.php on line 391
Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request in /home/wwwroot/xxxxxx/linuxSocket/vendor/workerman/workerman/Connection/TcpConnection.php on line 391
SSL Handshake fail.
Buffer:2e696f2f3f45494f3d33267472616e73706f72743d706f6c6c696e6726743d313530343433313337333833372d31313420485454502f312e310d0a486f73743a20626c6f672e68756967657a697a6a2e636f6d3a323132300d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a557365722d4167656e743a204d6f7a696c6c612f352e30202857696e646f7773204e542031302e303b20574f57363429204170706c655765624b69742f3533372e333620284b48544d4c2c206c696b65204765636b6f29204368726f6d652f34392e302e323632332e3735205361666172692f3533372e3336204c4242524f575345520d0a4f726967696e3a20687474703a2f2f626c6f672e68756967657a697a6a2e636f6d3a323132330d0a4163636570743a202a2f2a0d0a526566657265723a20687474703a2f2f626c6f672e68756967657a697a6a2e636f6d3a323132332f0d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174652c20736463680d0a4163636570742d4c616e67756167653a207a682d434e2c7a683b71
开启ssl后客户端就不能用http连了,得用https。
// 传入ssl选项,包含证书的路径
$context = array(
'ssl' => array(
'local_cert' => '/usr/local/nginx/ssl/1_xxxx_bundle.crt',
'local_pk' => '/usr/local/nginx/ssl/2_xxxx.key',
'verify_peer' => false,
)
);
// PHPSocketIO服务
$sender_io = new SocketIO(2120,$context);
现在是这样配置的。。已经添加了ssl证书
// 传入ssl选项,包含证书的路径
$context = array(
'ssl' => array(
'local_cert' => '/usr/local/nginx/ssl/1_xxxx_bundle.crt',
'local_pk' => '/usr/local/nginx/ssl/2_xxxx.key',
'verify_peer' => false,
)
);
// PHPSocketIO服务
$sender_io = new SocketIO(2120,$context);
现在是这样配置的。。已经添加了ssl证书
根据https://github.com/walkor/phpsocket.io/tree/master/docs/zh设置完ssl后,
客户端连接时不能再用http方式,要改成https类似下面这样。
<script>
var socket = io('https://yoursite.com:3120');
//.....
</script>
上面的报错就是有客户端用http明文连的导致的
[attach]749[/attach]
但是为什么配置是https 启动了就成了http呢?
webserver开启SSL不是这样设置下https就行了,开启SSL请参考手册 http://doc.workerman.net/315298,webserver也是同样的做法
另外启动界面里目前不显示是否是https,都是统一显示http