使用的是 phpstudy 中的 php apache
https-ssl.cof 下
Listen 443
<VirtualHost *:443>
DocumentRoot "xxx\xxx\xxx\xxx"
ServerName 域名
ServerAlias
# Proxy Config
SSLProxyEngine on
ProxyRequests Off
ProxyPass /wss ws://127.0.0.1:8383
ProxyPassReverse /wss ws://127.0.0.1:8383
<Directory "C:\phpStudy\WWW\plane">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP: MEDIUM
SSLEngine on
SSLHonorCipherOrder on
SSLCertificateFile "C:\phpStudy\Apache\cert\public.pem"
SSLCertificateKeyFile "C:\phpStudy\Apache\cert\214952355360180.key"
SSLCertificateChainFile "C:\phpStudy\Apache\cert\chain.pem"
</VirtualHost>
start_gateway.php 下
<?php
// 自动加载类
require_once __DIR__ . '/../../vendor/autoload.php';
// gateway 进程,这里使用Text协议,可以用telnet测试
$gateway = new Gateway("websocket://0.0.0.0:8383");
前端请求:
// 证书是会检查域名的,请使用域名连接
ws = new WebSocket("wss://域名/wss");
ws.onopen = function() {
alert("连接成功");
ws.send('tom');
alert("给服务端发送一个字符串:tom");
};
ws.onmessage = function(e) {
alert("收到服务端的消息:" e.data);
};
好了 配置问题 真是操蛋
[attach]1219[/attach]
Apache 里面突然少了这个 真是 想哭