Apache测试屏幕没有加载。连接到公共IP时连接被拒绝


0

我在让Apache工作时遇到了问题。我遵循亚马逊AWS说明(http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html)但我的计算机拒绝加载Amazon Linux测试屏幕。

在运行时curl localhost,我确实看到了测试屏幕的HTML,所以它可能意味着端口不正确?

我跑了netstat -lnp并粘贴了下面的输出:

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      -                   
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:55001               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      -                   
tcp        0      0 :::22                       :::*                        LISTEN      -                   
tcp        0      0 :::49475                    :::*                        LISTEN      -                   
tcp        0      0 :::111                      :::*                        LISTEN      -                   
tcp        0      0 :::80                       :::*                        LISTEN      -                   
udp        0      0 0.0.0.0:58316               0.0.0.0:*                               -                   
udp        0      0 0.0.0.0:974                 0.0.0.0:*                               -                   
udp        0      0 127.0.0.1:1001              0.0.0.0:*                               -                   
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               -                   
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               -                   
udp        0      0 172.31.25.11:123            0.0.0.0:*                               -                   
udp        0      0 127.0.0.1:123               0.0.0.0:*                               -                   
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               -                   
udp        0      0 :::974                      :::*                                    -                   
udp        0      0 :::53736                    :::*                                    -                   
udp        0      0 :::111                      :::*                                    -                   
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     7784   -                   @/com/ubuntu/upstart
unix  2      [ ACC ]     SEQPACKET  LISTENING     8016   -                   @/org/kernel/udev/udevd
unix  2      [ ACC ]     STREAM     LISTENING     9141   -                   /var/run/rpcbind.sock
unix  2      [ ACC ]     STREAM     LISTENING     9314   -                   /var/run/dbus/system_bus_socket

我也跟着https://help.ubuntu.com/community/IptablesHowTo并接受了到80端口的所有流量。

跑步sudo iptables -L -V,我得到:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere            
   61  4144 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:ssh
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:http
    6   866 ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
    0     0 DROP       all  --  any    any     anywhere             anywhere            

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 16 packets, 2356 bytes)
 pkts bytes target     prot opt in     out     source               destination      

任何帮助将非常感激!


我修好了你的code formatting。请在下次阅读Markdown帮助。
— DavidPostill

Answers:


0

如果尚未打开,则需要为AWS安全组打开80端口:

  • 转到左侧导航中的“安全组”设置
  • 找到您的实例所属的安全组
  • 单击“入站规则”
  • 使用下拉菜单并添加HTTP(端口80)
  • 单击“应用”并欣赏
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.