无法使用 AMI 设置和访问 EC2 上的 tomcat

无法使用 AMI 设置和访问 EC2 上的 tomcat

我尝试在运行 AMI 的 EC2 实例上启动 tomcat7,但无法使用公共 IP 从浏览器访问 Web 服务。

  1. 创建一个以默认 AMI 作为映像的 EC2 实例
  2. 创建弹性 IP 并将其与实例关联
  3. 安装 tomcat7 并确保它在 inet.d 中启动
  4. 在安全组中为 quick-start-1 创建了一个条目,并向其中添加了端口 8080。
  5. 已验证安全组已正确添加到实例。
  6. 已验证 tomcat 在端口 8080 上

无法使用公共 DNS 名称或 IP 地址从浏览器访问 http 服务器。

该实例的一些输出如下所示:

ec2-user@ip-10-202-49-142 ~$ sudo fuser -n tcp 8080
8080/tcp: 1162

 

ec2-user@ip-10-202-49-142 ~$ sudo netstat -apn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1019/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1088/sendmail
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1052/sshd
tcp 0 300 10.202.49.142:22 198.6.50.15:28002 ESTABLISHED 1253/sshd
tcp 0 0 ::1:631 :::* LISTEN 1019/cupsd
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 1162/java
tcp 0 0 :::8009 :::* LISTEN 1162/java
tcp 0 0 :::8080 :::* LISTEN 1162/java
tcp 0 0 :::22 :::* LISTEN 1052/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 928/dhclient
udp 0 0 0.0.0.0:631 0.0.0.0:* 1019/cupsd
udp 0 0 10.202.49.142:123 0.0.0.0:* 1073/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1073/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1073/ntpd
udp 0 0 fe80::1031:3bff:fe12:326:123 :::* 1073/ntpd
udp 0 0 ::1:123 :::* 1073/ntpd
udp 0 0 :::123 :::* 1073/ntpd
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 ACC STREAM LISTENING 3054 1237/gam_server @/tmp/fam-root-
unix 2 ACC STREAM LISTENING 1072 1/init @/com/ubuntu/upstart
unix 7 [ ] DGRAM 1882 978/rsyslogd /dev/log
unix 2 ACC STREAM LISTENING 2408 1019/cupsd /var/run/cups/cups.sock
unix 2 ACC SEQPACKET LISTENING 1139 584/udevd @/org/kernel/udev/udevd
unix 2 ACC STREAM LISTENING 1936 999/dbus-daemon /var/run/dbus/system_bus_socket
unix 2 [ ] DGRAM 3935 1318/sudo
unix 3 [ ] STREAM CONNECTED 3124 1253/sshd
unix 3 [ ] STREAM CONNECTED 3123 1256/sshd
unix 2 [ ] DGRAM 3120 1253/sshd
unix 3 [ ] STREAM CONNECTED 3057 1237/gam_server @/tmp/fam-root-
unix 3 [ ] STREAM CONNECTED 3056 1235/python
unix 3 [ ] STREAM CONNECTED 3041 999/dbus-daemon /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 3040 1235/python
unix 2 [ ] DGRAM 2780 1171/crond
unix 2 [ ] DGRAM 2663 1096/sendmail: Queu
unix 2 [ ] DGRAM 2645 1088/sendmail
unix 2 [ ] DGRAM 2566 1073/ntpd
unix 3 [ ] STREAM CONNECTED 1945 999/dbus-daemon /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 1944 1/init
unix 3 [ ] STREAM CONNECTED 1940 999/dbus-daemon
unix 3 [ ] STREAM CONNECTED 1939 999/dbus-daemon
unix 3 [ ] DGRAM 1155 584/udevd
unix 3 [ ] DGRAM 1154 584/udevd

 

ec2-user@ip-10-202-49-142 ~$ sudo iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ec2-user@ip-10-202-49-142 ~$ 

答案1

看起来只有一个 ipv6 tomcat 套接字,而没有 ipv4

:::8080 :::* LISTEN 1162/java

相关内容