php - Port Massacre - ECONNREFUSED in Node.js trying to cowork with Apache -
some info: running:
apache server listening on port 80, redirecting traffic https , listening on 443.
node.js server listening on port 8080 supposed used chat. using
request
module.i have php backend has functionality. using node.js message sending client php backend (i need websocket functionality)
i having certificate letsencrypt. want send post request php backend node.js server, here code that:
request.post({ url: 'https://%website%/?p=execpost', options: { key: fs.readfilesync('/etc/letsencrypt/live/%website%/privkey.pem'), cert: fs.readfilesync('/etc/letsencrypt/live/%website%/fullchain.pem') }, form: options2 }, function(error, response, body) { console.log(body); //debug console.log(response); console.log(error); //todo: emit response });
options2
in case form inputs. happens econnrefused error in node.js server. can cause of that? have defined certificates wrongly? have tried changing url to:
%website%:8080/ %website's ip address% %website's ip address%:8080
and several others weird tries, cause have no idea going on. error message:
{ error: connect econnrefused %website's ip address%:443 @ object.exports._errnoexception (util.js:1050:11) @ exports._exceptionwithhostport (util.js:1073:20) @ tcpconnectwrap.afterconnect [as oncomplete] (net.js:1093:14) code: 'econnrefused', errno: 'econnrefused', syscall: 'connect', address: '%website's ip address%', port: 443 }
i specify certificates when create server:
var server = https.createserver({ key: fs.readfilesync('/etc/letsencrypt/live/%website%/privkey.pem'), cert: fs.readfilesync('/etc/letsencrypt/live/%website%/fullchain.pem') }, app);
obviously can't send request through port 8080, because apache cannot listening there if node.js is, , can't set node.js on port 443, cause that's apache is. how can solve issue? loading certificates correctly?
additional info: here how client connects node.js server:
var socket = io.connect('https://%websites ip address%:8080', {secure: true});
the "https" on url bar in chrome browser crossed out , reports connection not secure, i'm guessing it's because of this.
Comments
Post a Comment