我创建了一个自签名证书并将其安装在 apache 和 node.js(端口 3000)上。在本地主机上都https://localhost
运行https://localhost:3000
良好。
因此,我购买了 GoDaddy 标准 SSL 证书并将其安装在服务器上(http://gatherify.com
)。现在https://gatherify.com
运行良好,但节点上的 ssl 不起作用。当我访问时,https://gatherify.com:3000
我得到“连接被中断”。
我执行了卷曲:
root@host [~]# curl -v -s -k https://gatherify.com:3000
* About to connect() to gatherify.com port 3000 (#0)
* Trying 108.160.156.123... connected
* Connected to gatherify.com (108.160.156.123) port 3000 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* NSS error -5938
* Closing connection #0
* SSL connect error
有什么建议可以解决这个问题吗?
更新 *服务器端: *
var io = require('socket.io'),
connect = require('connect'),
fs = require('fs'),
var privateKey = fs.readFileSync('cert/server.key').toString();
var certificate = fs.readFileSync('cert/server.crt').toString();
var options = {
key: privateKey,
cert: certificate
};
var app = connect(options).use(connect.static('../htdocs/node/'));
app.listen(3000);
var server = io.listen(app);
server.sockets.on('connection', function(socket) {
console.log("Connected");
});
客户端:
<html> <head>
<script type = "text/javascript" src = "https://gatherify.com:3000/socket.io/socket.io.js"></script>
<script type = "text/javascript">
var socket = io.connect('https://gatherify.com:3000', {secure:true});
</script>
</head><body></body></html>