简体   繁体   English

谷歌计算引擎外部IP

[英]Google compute engine external ip

I have a nodejs app in google compute engine which I can access with the given appspot adress. 我在谷歌计算引擎中有一个nodejs应用程序,我可以使用给定的appspot地址访问它。

In networking I set the ip adress as static. 在网络中,我将ip地址设置为静态。 I have added a firewall rule for allow any trafic , tcp:8080. 我添加了防火墙规则以允许任何流量,tcp:8080。

But when I try to go onto external ip adress on my browser it fails to load. 但是当我尝试在我的浏览器上进入外部ip地址时,它无法加载。 So I cannot acces my site with external ip adress. 因此我无法使用外部IP地址访问我的网站。

What should I do to be able to use external IP adress? 我该怎么做才能使用外部IP地址?

So it seems like , when you use "gcloud preview app deploy" command it deploys to google cloud compute engine where the app is runing on port 8080. 因此,当您使用“gcloud preview app deploy”命令时,它会部署到谷歌云计算引擎,其中应用程序在端口8080上运行。

To have a static IP to you project here are the steps to take: 要在此项目中拥有静态IP,请采取以下步骤:

1) In your code , create an app.yaml file. 1)在您的代码中,创建一个app.yaml文件。 Forward port 80 to port 8080 (where your app is listening) 将端口80转发到端口8080(您的应用正在侦听的位置)

    network:
     forwarded_ports:
     - 80:8080

2) go head and deploy you app 2)去头部署你的应用程序

   gcloud preview app deploy

3) In your google console go to NETWORKING > FIREWALL RULES and add new firewall rule for tcp:80 3)在您的谷歌控制台中,转到网络>防火墙规则并为tcp:80添加新的防火墙规则

4) Go onto EXTERNAL IP ADDRESSES and change your apps IP address to static. 4)转到外部IP地址并将您的应用IP地址更改为静态。

You will see your site runing on the external ip adress. 您将看到您的网站在外部IP地址上运行。

From your question, it seems like you're using Google App Engine to run your node.js application (given your mention of appspot.com domain). 从您的问题来看,您似乎正在使用Google App Engine来运行您的node.js应用程序(假设您提到了appspot.com域)。

If my assumption is correct, you don't need to assign any ip address to your instance/s - they all are managed by Google and the routing of requests from external world to your application is done by App Engine. 如果我的假设是正确的,您不需要为您的实例分配任何IP地址 - 它们都由Google管理,并且外部世界向您的应用程序发出的请求路由由App Engine完成。

You should access your app just by your_app_name.appspot.com or if you wish to use your own, custom domain, please use this guide to achieve it. 您应该只通过your_app_name.appspot.com访问您的应用,或者如果您希望使用自己的自定义域,请使用本指南来实现它。 This will also help you to setup SSL, if you want/need it for your app. 如果您想要/需要它,您还可以帮助您设置SSL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM