我在使用 Apache 时遇到了问题。我已按照 Amazon 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
任何帮助将非常感激!
答案1
如果您尚未打开,则需要为您的AWS安全组打开80端口:
- 转到左侧导航栏中的“安全组”设置
- 找到您的实例所属的安全组
- 点击入站规则
- 使用下拉菜单并添加 HTTP(端口 80)
- 单击“应用”并享受