Nodejs站点无法在浏览器中显示

时间:2013-06-13 01:59:20

标签: node.js browser iptables rhel

我在RHEL6上设置了一个nodejs站点。一切看起来都不错,但我无法在浏览器中查看我们的网站(在Chrome,Safari和IE9中都失败了)。我可以使用curl获取正确的html响应。以下是使用不同工具的测试结果。 有没有人遇到过同样的情况?

〜] $ nmap -v -A 123.150.207.18 -p80

Starting Nmap 5.21 ( http://nmap.org ) at 2013-06-13 07:51 CST
NSE: Loaded 36 scripts for scanning.
Initiating Ping Scan at 07:51
Scanning 123.150.207.18 [2 ports]
Completed Ping Scan at 07:51, 0.00s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 07:51
Completed Parallel DNS resolution of 1 host. at 07:51, 4.00s elapsed
Initiating Connect Scan at 07:51
Scanning 123.150.207.18 [1 port]
Discovered open port 80/tcp on 123.150.207.18
Completed Connect Scan at 07:51, 0.00s elapsed (1 total ports)
Initiating Service scan at 07:51
Scanning 1 service on 123.150.207.18
Completed Service scan at 07:51, 11.13s elapsed (1 service on 1 host)
NSE: Script scanning 123.150.207.18.
NSE: Starting runlevel 1 (of 1) scan.
Initiating NSE at 07:51
Completed NSE at 07:51, 0.03s elapsed
NSE: Script Scanning completed.
Nmap scan report for 123.150.207.18
Host is up (0.00057s latency).
PORT   STATE SERVICE VERSION
80/tcp open  http?
|_http-favicon: Unknown favicon MD5: 1D0E785BFCEDDE5326C2460E9F9B261D
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :
SF-Port80-TCP:V=5.21%I=7%D=6/13%Time=51B90999%P=x86_64-redhat-linux-gnu%r(
SF:GetRequest,233B,"HTTP/1\.1\x20200\x20OK\r\nX-Powered-By:\x20Express\r\n
SF:Content-Type:\x20text/html;\x20charset=utf-8\r\nContent-Length:\x208714
SF:\r\nETag:\x20\"891558458\"\r\nSet-Cookie:\x20connect\.sid=s%3AkL3pj-Tzt
SF:rF-hh7Mtjhc85Br\.Nfkgt%2FzHRJ%2FIFiIIqNqW0sSQ7%2F%2Brx%2FWldcrVkNrhQLA;
SF:\x20Path=/;\x20HttpOnly\r\nDate:\x20Wed,\x2012\x20Jun\x202013\x2023:51:
SF:53\x20GMT\r\nConnection:\x20close\r\n\r\n<!DOCTYPE\x20html>\n<html\x20l
SF:ang=\"en\">\n<head>\n\x20\x20\x20\x20<meta\x20charset=\"utf-8\">\n\x20\
SF:x20\x20\x20<meta\x20http-equiv=\"content-type\"\x20content=\"text/html;
SF:\x20charset=UTF-8\">\n\x20\x20\x20\x20<meta\x20name=\"viewport\"\x20con
SF:tent=\"width=device-width,\x20initial-scale=1\.0\">\n\x20\x20\x20\x20<m
SF:eta\x20name=\"description\"\x20content=\"\">\n\x20\x20\x20\x20<meta\x20
SF:name=\"author\"\x20content=\"\">\n\x20\x20\x20\x20<title>\xe7\x95\xaa\x
SF:e8\x8c\x84\xe5\xbf\xab\xe8\xb7\x91\x20--\x20\xe4\xb8\xad\xe5\x9b\xbd\xe
SF:6\x9c\x80\xe5\xb0\x8f\xe5\xb7\xa7\xe7\x9a\x84\xe6\x97\xb6\xe9\x97\xb4\x
SF:e7\xae\xa1\xe7\x90\x86\xe5\xb7\xa5\xe5\x85\xb7</title>\n\x20\x20\x20\x2
SF:0<link\x20rel=\"shortcut\x20icon\"\x20href=\"\./tomatodo/img/tomato_32\
SF:.png\">\n\x20\x20\x20\x20<link\x20rel=\"stylesheet\"\x20href=\"\./boots
SF:trap/css/bootstrap\.css\">\n\x20\x20\x20\x20<link\x20rel=\"stylesheet\"
SF:\x20href=\"\./bootstrap/css/bootstrap-responsive\.css\">\n\x20\x20\x20\
SF:x20<link\x20rel=\"styleshee")%r(HTTPOptions,109,"HTTP/1\.1\x20404\x20No
SF:t\x20Found\r\nX-Powered-By:\x20Express\r\nContent-Type:\x20text/plain\r
SF:\nSet-Cookie:\x20connect\.sid=s%3A_s6k4167c1xZ4bmi6GaUW0ld\.OcixsFK4HAI
SF:53dXqebPJ%2FNp0EPpGtDMPsFRvTFkLj8A;\x20Path=/;\x20HttpOnly\r\nDate:\x20
SF:Wed,\x2012\x20Jun\x202013\x2023:51:53\x20GMT\r\nConnection:\x20close\r\
SF:n\r\nCannot\x20OPTIONS\x20/")%r(FourOhFourRequest,12A,"HTTP/1\.1\x20404
SF:\x20Not\x20Found\r\nX-Powered-By:\x20Express\r\nContent-Type:\x20text/p
SF:lain\r\nSet-Cookie:\x20connect\.sid=s%3AiYSdu5oWddVC54Rergi65gAg\.TOE5n
SF:nutt90l1Xjv%2BG28sy%2BA230zvU9ccDqNTgQEQco;\x20Path=/;\x20HttpOnly\r\nD
SF:ate:\x20Wed,\x2012\x20Jun\x202013\x2023:51:53\x20GMT\r\nConnection:\x20
SF:close\r\n\r\nCannot\x20GET\x20/nice%20ports%2C/Tri%6Eity\.txt%2ebak");

Read data files from: /usr/share/nmap
Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 15.36 seconds

〜] $ sudo netstat -plunt

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2183/sshd           
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      2073/cupsd          
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      2259/master         
tcp        0      0 0.0.0.0:56378               0.0.0.0:*                   LISTEN      1924/rpc.statd      
tcp        0      0 0.0.0.0:27017               0.0.0.0:*                   LISTEN      20904/mongod        
tcp        0      0 0.0.0.0:6379                0.0.0.0:*                   LISTEN      11590/redis-server  
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1903/rpcbind        
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      21220/node          
tcp        0      0 0.0.0.0:28017               0.0.0.0:*                   LISTEN      20904/mongod        
tcp        0      0 :::22                       :::*                        LISTEN      2183/sshd           
tcp        0      0 ::1:631                     :::*                        LISTEN      2073/cupsd          
tcp        0      0 ::1:25                      :::*                        LISTEN      2259/master         
tcp        0      0 :::40334                    :::*                        LISTEN      1924/rpc.statd      
tcp        0      0 :::111                      :::*                        LISTEN      1903/rpcbind        
udp        0      0 0.0.0.0:55512               0.0.0.0:*                               1924/rpc.statd      
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1903/rpcbind        
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               2073/cupsd          
udp        0      0 0.0.0.0:806                 0.0.0.0:*                               1903/rpcbind        
udp        0      0 0.0.0.0:828                 0.0.0.0:*                               1924/rpc.statd      
udp        0      0 :::49640                    :::*                                    1924/rpc.statd      
udp        0      0 :::111                      :::*                                    1903/rpcbind        
udp        0      0 :::806                      :::*                                    1903/rpcbind       

〜] $ sudo / sbin / service iptables status

Table: nat
Chain PREROUTING (policy ACCEPT)
num  target     prot opt source               destination         

Chain POSTROUTING (policy ACCEPT)
num  target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         

Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 
6    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           multiport ports 80,8080 
7    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80 

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination     

〜] $ curl 123.150.207.18:80

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
......

1 个答案:

答案 0 :(得分:0)

我更正了iptables设置后解决了。其他配置没有问题。