iptables 里所有端口打开了
iptables -apn 能看到 0.0.0.0:80 端口处在被监听
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:872 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
但是访问ip 就是不显示内容,完全不知道怎么回事,求助大家.
var http = require(‘http’); http.createServer(function (req, res) { res.writeHead(200, {’Content-Type’: 'text/plain’}); res.end(‘Hello Node.js\n’); }).listen(80); console.log(‘Server running’);
没问题呀
$ sudo node ptest.js &
[1] 12704
$ Server running
$ wget http://localhost
--2013-04-17 10:49:23-- http://localhost/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: `index.html'
[ <=> ] 14 --.-K/s in 0s
2013-04-17 10:49:23 (1.54 MB/s) - `index.html' saved [14]
$ cat ptest.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.js\n');
}).listen(80);
console.log('Server running');
$ cat index.html
Hello Node.js
[root@colud ~]# wget http://198.100.114.49
–2013-04-17 22:58:36-- http://198.100.114.49/ 正在连接 198.100.114.49:80… 已连接。 已发出 HTTP 请求,正在等待回应… 200 OK 长度:未指定 [text/plain] 正在保存至: “index.html.1”
[ <=> ] 14 --.-K/s in 0s
2013-04-17 22:58:36 (1.91 MB/s) - “index.html.1” 已保存 [14]
我用服务器访问没问题, 但是用外网就进不去了 …
你在加州?你的ISP可能没给你 80 端口。
12 16.901 216.218.213.251 216.218.213.251 Morgan Hill, CA, United States
13 19.253 199-73-121-10.static.gorillaservers.com 199.73.121.10 , ,
14 7.882 198-100-114-49.static.gorillaservers.com 198.100.114.49 , ,