如何通过浏览器访问Google Cloud Engine实例的IP地址 [英] How to access Google Cloud Engine instance's IP address via browser

查看:139
本文介绍了如何通过浏览器访问Google Cloud Engine实例的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过此解决方案

在安装JIRA Core应用程序后,我遇到了同样的问题,并且可以通过以下步骤解决它.老实说,我没有安装MEAN堆栈,但是解决此错误的大多数步骤必须相同(端口验证和服务执行除外).

  1. 第一件事是在官方文档和该应用程序的安装生成的某些配置文件中检测MEAN stack应用程序使用的端口. 根据评论中的信息,该应用使用端口3000

  2. 您转到GCP控制台添加VPC网络防火墙规则.

    a.您选择实例所在的项目.

    b.选择 VPC网络->防火墙规则->创建

    c.名称:均值堆

    d. IP间隔:0.0.0.0/0

    e.协议/端口:tcp:3000; udp:3000

  3. 列出VM正在从Cloud Shell侦听或防火墙启用的端口:

    $ netstat -an | grep "LISTEN "

  4. 您必须打开用于阻止防火墙的MEAN堆栈的端口.如果端口正在侦听,则无需执行此步骤:

    $ sudo apt-get install ufw

    $ sudo ufw enable

    $ sudo ufw allow ssh//以免被ssh与实例断开连接

    $ sudo ufw allow 3000

    如果该应用使用了更多控制端口,则还必须启用它们

  5. 您应该使用某些命令检查该应用程序是否已启动并正在运行(例如:sudo/opt/bitnami/ctlscript.sh启动apache)

  6. 您应该测试是否可以通过URL在本地访问MEAN stack应用.以下命令不必让我拒绝连接.

    $ sudo wget http://localhost:3000

    请勿输入wget生成的URL,因为必须使用外部ip来完成.

  7. 最后,在为实例的项目创建防火墙规则并启用阻止防火墙的端口后,您可以通过浏览器从任何客户端访问该

    .

    http://< external-ip-vm>:<端口>

    http://104.154.39.199:3000

希望我能在某个时候为您提供帮助. GL

I installed a MEAN stack on Google Cloud Engine (GCE) via this link.

So the engine created my instance successfully and it looks like this:

I created a new firewall rule to accept any incoming requests (actually do I need to do this? default-allow-http has the same rule right?):

But when I try to access the IP using Chrome, I get an error. The error persists even when I change the browser e.g. IE or Firefox:

I have confirmed that I can ping the address:

I even tried to assign a domain name to the instance but it still does not work:

May I know what I am doing wrongly?

Would appreciate any advice! Thanks in advance!

解决方案

I had the same problem after installing the JIRA Core app, and I was able to solve it with the following steps. I honestly did not install MEAN stack but most of the steps to solve this error must be the same (except for port verification and service execution).

  1. The first thing is to detect the port used by MEAN stack app in the official documentation and in some configuration file generated by the installation of the app. According to information in the comments the app uses the port 3000

  2. You go to the GCP console to add a VPC Network firewall rule.

    a. You choose the project where you have the instance.

    b. Select VPC Network -> Firewall Rules -> Create

    c. Name: mean-stack

    d. Intervals of IPs: 0.0.0.0/0

    e. Protocols/ports: tcp:3000; udp:3000

  3. List the ports that the VM is listening to or the firewall enables from the Cloud Shell:

    $ netstat -an | grep "LISTEN "

  4. You have to open the port for MEAN stack that blocks the firewall. If the port is listening, this step is not necessary:

    $ sudo apt-get install ufw

    $ sudo ufw enable

    $ sudo ufw allow ssh //so as not to be disconnected from the instance by ssh

    $ sudo ufw allow 3000

    If the app uses more control ports, you must also enable them

  5. You should check that the app is on and running with some command (For example: sudo /opt/bitnami/ctlscript.sh start apache)

  6. You should test if you can access the MEAN stack app locally through the URL. The following command does NOT have to give me connection refused.

    $ sudo wget http://localhost:3000

    Do not enter the URL generated by wget, as it must be done with an external ip.

  7. Finally, after creating a firewall rule for the project of the instance and enabling the port that blocks the firewall you can access from any client through the browser.

    http://< external-ip-vm >:< port >

    http://104.154.39.199:3000

I hope I can help you at some point. GL

这篇关于如何通过浏览器访问Google Cloud Engine实例的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆