我在 Laravel 项目中使用 https 和 websocket 连接。我已设置虚拟主机,如下所示:
<VirtualHost *:80>
ServerName test.example.com
ServerAdmin test.example.com
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin test.example.com
ServerName test.example.com
SSLEngine on
SSLCertificateFile "cert.pem"
SSLCertificateKeyFile "privkey.pem"
SSLCertificateChainFile "chain.pem"
SSLProxyEngine On
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /wss wss://test.example.com:8090/
ProxyPassReverse /wss wss://test.example.com:8090/
DocumentRoot "/var/www/html/laravel/public"
<Directory "/var/www/html/laravel/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
但它在浏览器中显示错误:
WebSocket connection to 'wss://test.example.com:8090/' failed: WebSocket opening handshake timed out
配置如下:
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
6426/systemd-resolv
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
937/sshd
tcp 0 0 {{MY publicIP}}:8090 0.0.0.0:* LISTEN
11576/php
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
19335/mysqld
您能帮助我们解决什么问题吗?
提前致谢