问题
我正在尝试使用 apache 服务器后面的 laravel websockets 库设置一个实时环境。Websocket 服务器正在端口上运行6001
(无法从外部访问)。Apache VHost 配置为ws.example.com
我无法让 Apachewss://
正确代理请求。请求wss://ws.example.com/request/path?protocol=7&client=js&version=5.1.1&flash=false
失败。( Error during WebSocket handshake: Invalid status line
)
我认为我的虚拟主机配置有问题。我错过了什么吗?任何建议表示赞赏。
虚拟主机配置
<VirtualHost *:443>
ServerName ws.example.com
ServerAlias www.ws.example.com.com
DocumentRoot /srv/vhost/example.com/domains/ws.example.com/public_html
ErrorLog /var/log/virtualmin/ws.example.com_error_log
CustomLog /var/log/virtualmin/ws.example.com_access_log combined
ScriptAlias /cgi-bin/ /srv/vhost/example.com/domains/ws.example.com/cgi-bin/
DirectoryIndex index.php index.html
RewriteEngine on
ProxyRequests off
ProxyVia on
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) ws://localhost:6001/$1 [P,L]
ProxyPass /request/path http://localhost:6001/request/path
ProxyPassReverse /request/path http://localhost:6001/request/path
SSLCertificateFile /etc/letsencrypt/path/ws.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/path/ws.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>