I have a remote server running on Ubuntu 14.04. I have used express-generator to create a basic express APP.
The nodeJS is listening on port 8000. When I make a request using the http://ServerIP:8000 there is no response. The HTTP request is actually going through but does not seem to reach the nodejs process.
sudo tcpdump -vv -x -X -s 1500 -i interface1 'port 8000'
xx.xx.xx.xx > yy.yy.yy.yy.8000: Flags [S], cksum 0x18b7 (correct), seq 202090794, win 65535, options [mss 1400,sackOK,eol], length 0
0x0000: 4500 0030 772d 4000 3406 c4d6 6ad8 a9fb E..0w-@.4...j...
0x0010: c0a8 3548 8c6b 1f40 0c0b a92a 0000 0000 ..5H.k.@...*....
0x0020: 7002 ffff 18b7 0000 0204 0578 0402 0000 p..........x....
tt.tt.tt IP (tos 0x0, ttl 52, id 1450, offset 0, flags [DF], proto TCP (6), length 48)
xx.xx.xx.xx > yy.yy.yy.yy.8000: Flags [S], cksum 0x00c3 (correct), seq 1654024850, win 65535, options [mss 1400,sackOK,eol], length 0
0x0000: 4500 0030 05aa 4000 3406 365a 6ad8 a9fb E..0..@.4.6Zj...
0x0010: c0a8 3548 8c6c 1f40 6296 6a92 0000 0000 ..5H.l.@b.j.....
0x0020: 7002 ffff 00c3 0000 0204 0578 0402 0000 p..........x....
Also
netstat -pan | grep 8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 2769/node
Any idea whats going wrong/what I'm missing ?
In your app.js try to define your addresss and your port
var server = app.listen(8000, function () {
var host = server.address().address;
var port = server.address().port; // put your adress here :)
console.log('Example app listening at http://%s:%s', host, port);
});
Tell me if it works :)
I got the problem solved using nginx as a reverse proxy and redirect traffic to the nodejs server. I'm not really sure what the problem still is.
PS : Should I close the question ?? Or should I wait for an explanation ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.