swoole中使用wss

1,websocket客户端中需要将协议换成wss

2, 在nginx中监听433接口,并配置ssl证书

3,安装swoole扩展时候,需要enable openssl、http2

4,在swoole server中增加以下配置

'dispatch_mode' => 2,//4.6中dispatch_mode必须是2
'ssl_cert_file' => '/etc/nginx/ssl/wuyou.dew.crt', 
'daemonize' => true, //可以让服务变成守护进程,当ssh终端退出后,程序依然在运行,但是不会开机自启动。如果在生产服务器上,建议还是使用supervisor
'ssl_key_file' => '/etc/nginx/ssl/wuyou.dew.key', 
'open_http2_protocol' => true,

  

作者:冯亮
         
能力有限,水平一般。如有错误,欢迎指正
原文地址:https://www.cnblogs.com/fengliang/p/14950904.html