I have an Apache server running with SSL enabled. Now I made a small chat which is using node.js and socket.io to transmit data. Using port 8080 on a none secured connection is working just fine, but when I try it on a SSL secured domain it is not working. I do not get how the whole setup should work since SSL is only working through port 443. Apache is already listining on port 443. On which port should socket.io listen?
-
1Possible duplicate of stackoverflow.com/questions/6599470/node-js-socket-io-with-sslFallexe– Fallexe2013-06-01 02:55:24 +00:00Commented Jun 1, 2013 at 2:55
-
@Fallexe not really. He is using node.js without Apache. In my case Apache is already using port 443Aley– Aley2013-06-01 09:45:48 +00:00Commented Jun 1, 2013 at 9:45
-
I've never tried to run Apache and socket on the same port, but here is something similar w/o ssl stackoverflow.com/questions/11172351/…Fallexe– Fallexe2013-06-01 10:28:39 +00:00Commented Jun 1, 2013 at 10:28
Add a comment
|
1 Answer
I had to set the SSL certificates like
var fs = require('fs');
var options = {
key: fs.readFileSync('/etc/ssl/ebscerts/wildcard.my_example.com.no_pass.key'),
cert: fs.readFileSync('/etc/ssl/ebscerts/wildcard.my_example.com.crt'),
ca: fs.readFileSync('/etc/ssl/ebscerts/bundle.crt')
};
var app = require('https').createServer(options),
io = require('socket.io').listen(app);
app.listen(8080);
I found the solution on github