如何让webserver实现两个功能 1.http访问自动跳转https 2.http和https可以同时访问
use Workerman/Protocols/Http; Http::header('Location: https://domain.com/xxx'); https默认是443端口,开启方法类似 $context = array( 'ssl' => array( 'local_cert' => '/etc/nginx/conf.d/ssl/server.pem', // 也可以是crt文件 'local_pk' => '/etc/nginx/conf.d/ssl/server.key', 'verify_peer' => false, ) ); // 这里设置的是websocket协议,也可以http协议或者其它协议 $worker = new WebServer('http://0.0.0.0:443', $context); // 设置transport开启ssl $worker->transport = 'ssl';