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
----------------------------------------------------------------
小程序代碼(運行結(jié)果):
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