在 AWS 弹性 beantalk 上的 laravel 中获取安全 websocket 时遇到问题。
它们通过 http 和 ws 在开发和生产中运行良好。
在开发中,它在 https 和 wss 上运行良好。
在生产中(所有相同的设置,只是不同的证书)通过 https 和 wss 我收到以下错误
失败:连接建立错误:net::ERR_CONNECTION_CLOSED
假设证书或密钥有问题,我尝试更改为不正确的证书和密钥。然后错误变为以下。
失败:连接建立错误:net::ERR_SSL_VERSION_OR_CIPHER_MISMATCH
所以我假设证书不是问题。
配置如下:websockets.php
'apps' => [
[
'id' => env('PUSHER_APP_ID'),
'name' => env('APP_NAME'),
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'path' => env('PUSHER_APP_PATH'),
'capacity' => null,
'enable_client_messages' => true,
'enable_statistics' => true,
],
],
'ssl' => [
/*
* Path to local certificate file on filesystem. It must be a PEM encoded file which
* contains your certificate and private key. It can optionally contain the
* certificate chain of issuers. The private key also may be contained
* in a separate file specified by local_pk.
*/
'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null),
/*
* Path to local private key file on filesystem in case of separate files for
* certificate (local_cert) and private key.
*/
'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null),
/*
* Passphrase for your local_cert file.
*/
'passphrase' => env('LARAVEL_WEBSOCKETS_SSL_PASSPHRASE', null),
'verify_peer' => false,
],
.env 文件
LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=/etc/pki/tls/certs/cert.cer
LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=/etc/pki/tls/certs/server.key