apache配置:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
httpd-ssl配置:
<VirtualHost *:443>
DocumentRoot "C:\WWW\grpt\public"
ServerName xxx.xxx.com:443
SSLEngine on
ProxyRequests Off
ProxyPass /wss ws://0.0.0.0:8008
ProxyPassReverse /wss ws://0.0.0.0:8008
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
SSLHonorCipherOrder on
SSLCertificateFile C:/phpStudy1/Apache/conf/grpt_cert/public.pem
SSLCertificateKeyFile C:/phpStudy1/Apache/conf/grpt_cert/214493524050581.key
SSLCertificateChainFile C:/phpStudy1/Apache/conf/grpt_cert/chain.pem
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/phpStudy/Apache/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
CustomLog "C:/phpStudy/Apache/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
workerman启动运行:
----------------------- WORKERMAN -----------------------------
Workerman version:3.3.90 PHP version:5.6.27
------------------------ WORKERS -------------------------------
worker listen processes status
ChatGateway websocket://0.0.0.0:8008 1
YourAppBusinessWorker none 4
Register text://0.0.0.0:8004 1
----------------------------------------------------------------
小程序代码(运行结果):
wx.connectSocket({
url: 'wss://' + domain+’/wss‘,
data: parame.data,
header: {
'content-type': 'application/json'
},
protocols: parame.protocol,
method: "GET",
success: res => {
if (parame.success){
parame.success(res);
}
}
})
// 'wss://' + domain 这样报错 failed: Error during WebSocket handshake: Unexpected response code: 302
// 'wss://' + domain+’/wss‘ 这样报错 failed: Error during WebSocket handshake: Unexpected response code: 503
连接的域名和apache里的ServerName不匹配吧
匹配的 在这里只是隐藏真实域名了而已
0.0.0.0:8008 好像不对,应该是127.0.0.1:8008吧
/wss ws://0.0.0.0:8008 改成 /wss ws://127.0.0.1:8008 试下吧
@1479:参照官方手册的
@1479:官方手册不是这样
@1479:http://doc.workerman.net/315297
ssl 的握手到底是在哪个环节完成的呢?
反正我用 Nginx 作反向代理,用 proxy_pass 转发给 Workerman 的时候,是由 Workerman 这边来负责 ssl 握手的。
看你这个 Apache 的配置,貌似 Workerman 这边并没有负责 ssl 握手,也许问题在这里吧……
我可能要转Nginx了
ServerName没有端口号的