dongzhanjuan5141 2014-11-25 18:02
浏览 89
已采纳

亚马逊AWS EC2 GoLang

I have a small Go web server which I have deployed on Amazon Web Services but I am having trouble getting to work.

My EC2 instance has both public & private IP addresses assigned, but I am unable to start the Go server.

If I serve it on localhost it works, but obviously I can't connect to it, so I am trying to assign it the public ip, but it crashes without throwing any errors.

http.ListenAndServe("public_ip", nil)

Any ideas how to proceed from here?

  • 写回答

2条回答 默认 最新

  • dptpn06684 2014-11-25 18:17
    关注

    I'm not sure what does it mean that your server crashes without throwing any errors. Make sure you're logging the error:

    log.Println(http.ListenAndServe(addr, nil))
    

    This should give you some idea why it doesn't work. Anything there?

    For example, when running on port < 1024 without root privileges, I can see:

    2014/11/25 19:14:51 listen tcp :80: bind: permission denied
    

    Now, if you run the server on address :8080, you should be listening on all the interfaces. You can test the server from the local host. If it works, make sure your machine is reachable from the Internet on this port by modifying security group for your instance.

    If it still doesn't work, please let us know what does and a little bit more about the crash.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持