我創建了一個自簽名證書,並將其安裝在apache以及node.js(端口3000)上。在本地主機上,https://localhost
和https://localhost:3000
都能正常工作。在節點服務器上安裝SSL證書
因此,我購買了GoDaddy Standard SSL證書並將其安裝在服務器上(http://gatherify.com
)。現在https://gatherify.com
工作正常,但節點上的ssl不起作用。 當我訪問https://gatherify.com:3000
時,我得到「連接中斷」。
我執行卷曲:
[email protected] [~]# 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
任何建議,以解決這一問題?
UPDATE * 服務器端: *
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>
該主機上的端口3000不使用SSL,只是普通的HTTP,因此使用https URL訪問它將失敗。 – 2013-03-10 17:05:05
你有'key'和'crt'證書文件嗎? – udidu 2013-03-10 17:06:19
@JoachimIsaksson那麼,我該如何解決這個問題? – Praveen 2013-03-10 17:20:28