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 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题