英文:
google cloud vm instance does not listen to external or internal ip adresses
问题
我有一个Java Spring框架的后端,还包含了REST API。我已经成功将这个应用部署在Google Cloud Platform的虚拟机实例中,在将Eclipse与Google Cloud Platform连接后。我下载了Google Cloud SDK安装程序来实现这个。刚开始时,当我尝试运行:https://industrial-net-242708.appspot.com/...时,我收到了404错误:未找到。当我运行这个:https://35.228.187.51:80 时,我得到了:
"这个网站无法访问。35.228.187.51拒绝了连接。"
然后,我将我的Spring应用改成了Spring Boot,我得到了这个错误:500,或者当我从SSH终端运行这个:https://35.228.187.51:80 时,我得到了连接错误超时。
我还为虚拟机实例的防火墙规则 - VPC网络创建了HTTP、HTTPS(80、443)端口。
然后我在SSH终端中运行了netstat -l命令,结果如下:
"活动的Internet连接(仅限服务器)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 instance-education-:ntp 0.0.0.0:*
udp 0 0 localhost:ntp 0.0.0.0:*
udp 0 0 0.0.0.0:ntp 0.0.0.0:*
udp6 0 0 fe80::4001:aff:fea6:ntp [::]:*
udp6 0 0 localhost:ntp [::]:*
udp6 0 0 [::]:ntp [::]:*
活动的UNIX域套接字(仅限服务器)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 10254 /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 9003 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 9015 /run/systemd/journal/stdout
unix 2 [ ACC ] STREAM LISTENING 10299 /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 9020 /run/systemd/fsck.progress
unix 2 [ ACC ] SEQPACKET LISTENING 9141 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 13840 /tmp/ssh-1toYloB0sh/agent.973"
如果我理解得正确,虚拟机没有监听IP地址(外部、内部),这就是我得到这个错误的原因。您知道我可以做什么来解决这个问题吗?
我的Java应用在一个Google Cloud服务器上运行,使用的是Debian 9 / Linux操作系统。
我的计算机使用的是Windows 10操作系统。任何帮助都将不胜感激。
英文:
I have a java spring framework back end which also contains rest api . I deployed successfully the app in vm instance google cloud platform, after connecting eclipse with google cloud platform. I downloaded googlecloussdkinatller for that. At the beginning, when I tried to run: https://industrial-net-242708.appspot.com/..., I got a 404 error: not found . When I ran this one: https://35.228.187.51:80 , I got:
''' This site can’t be reached 35.228.187.51 refused to connect. '''
Then I changed my spring aplication to spring boot and I got this error : 500 or when I ran this one from the ssh terminal: https://35.228.187.51:80 , I got connection error time.
I have also created http, https (80, 443) ports in firewall rules - vpc network fot the vm instance.
Then I ran the netstat -l command in the ssh terminal and the result was :
'''
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 instance-education-:ntp 0.0.0.0:*
udp 0 0 localhost:ntp 0.0.0.0:*
udp 0 0 0.0.0.0:ntp 0.0.0.0:*
udp6 0 0 fe80::4001:aff:fea6:ntp [::]:*
udp6 0 0 localhost:ntp [::]:*
udp6 0 0 [::]:ntp [::]:*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 10254 /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 9003 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 9015 /run/systemd/journal/stdout
unix 2 [ ACC ] STREAM LISTENING 10299 /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 9020 /run/systemd/fsck.progress
unix 2 [ ACC ] SEQPACKET LISTENING 9141 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 13840 /tmp/ssh-1toYloB0sh/agent.973
'''
If I understand this correctly , the vm is not listening to ip adresses (external, internal) this is why I am getting the error. Do you know what I could do to fix it ?
My java application runs in a google cloud server debian 9 / linux .
My computer has Windows 10 as an OS>. Any help appreciated
专注分享java语言的经验与见解,让所有开发者获益!
评论