我正在尝试设置Apache 2.4(在Virtualmin上)将wss://sub.domain.com
请求转发到ws://localhost:6001
,但是我没有成功。我已经遵循了无数的教程,并查看了大量的Stackoverflow问题-但我仍然感到困惑。
我已经安装并启用了proxy
,proxy_http
,proxy_wstunnel
和rewrite
。
首先我尝试了:
ServerName sub.domain.com
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:6001/$1 [P,L]
ProxyPass / http://127.0.0.1:6001/
ProxyPassReverse / http://127.0.0.1:6001/
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/key.pem
SSLCertificateChainFile /path/to/chain.pem
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite HIGH:!aNULL:!MD5
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
然后我尝试了:
ServerName sub.domain.com
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:6001/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:6001/$1 [P,L]
ProxyPreserveHost on
ProxyPass / ws://localhost:6001/
ProxyPassReverse / ws://localhost:6001/
...ssl directives
几乎涵盖了两者的每种组合。
至于 WebSocket 服务器,我正在使用端口 6001 上的 Laravel-websockets。
我做错了什么?