douqian4411 2018-04-03 01:09
浏览 183

在生产中部署Golang(Beego)

I came from a PHP background w/c is you can easily throw a PHP file in a server and that's it! How about in Golang, to be specific is the Beego framework because I already created a website using Beego but my stopper is (Q1)How to deploy in Ubunto and NGINX environment? (Q2)Do i need to compile the Beego project before deploying? (Q3)Do i need NGINX/Apache as server or use the built-in "run" of Beego?

Thank You.

  • 写回答

3条回答 默认 最新

  • duanhuai7532 2018-04-03 01:23
    关注

    1 - Pretty much install golang (Using the built-in version: sudo apt-get install golang-go or Detailed guide) and build the project or simply copy the built project and their libs if needed;

    2 - Ideally, the production environment shouldn't include the source codes on most scenarios, therefore a built server could be better.

    3 - Although not required, most people recommend to run golang behind a nginx. The reason for that is due to several optimizations (eg:static files serving) made on NGinx/Apache, which you would be missing on direct running your bin on server 80.

    Side notes:
    - the go run ... is the same thing as the go build ... + run the built executable
    - If you are just deploying the binary, build using the same OS / configurations.
    - Remember to follow the basic security guides, just open the ports needed, secure the server before deploying, limit users access, etc.

    评论

报告相同问题?

悬赏问题

  • ¥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时遇到的编译问题