Beego is an HTTP framework that helps you develop Go applications. You can use Beego to develop various applications, such as API operations, Web servers, and backend services. This topic describes how to develop a simple Beego application and deploy the application in Web App Service.

Step 1: Install Beego

  1. Use the following commands to install Beego and the bee tool:
    go get -u
    go get -u
  2. Use the following commands to add the $GOPATH/bin directory to the $PATH environment variable:
    echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.profile
    source >> ~/.profile

Step 2: Create an application

  1. Open a shell, and navigate to a folder that points to $GOPATH/src. Then, use the following command to create a project named webplusdemo.
    bee new webplusdemo
    The preceding command creates a directory named webplusdemo. The structure of the directory is as follows:
    ├── conf
    │   └── app.conf
    ├── controllers
    │   └── default.go
    ├── main.go
    ├── models
    ├── routers
    │   └── router.go
    ├── static
    │   ├── css
    │   ├── img
    │   └── js
    │       └── reload.min.js
    ├── tests
    │   └── default_test.go
    └── views
       └── index.tpl
  2. Navigate to the project directory and use the bee run command.
  3. Enter http://localhost:8080 in the address bar of a browser to access the project.

Step 3: Create a deployment package

  1. Create a file named Procfile in the project directory and add the following command to the file. You can use the Procfile file to specify the start command for a Go application.
    web: ./webplusdemo
  2. Use the bee tool to archive the project.
    bee pack -be GOOS=linux -be GOARCH=amd64 -f zip

    After the preceding command is complete, a deployment package named is created. Proceed as follows to deploy the Go application in Web App Service.

Step 4: Create and deploy an application

  1. Log on to the Web+ console.
  2. On the Overview page, click Create in the upper-right corner of the Last Updated Deployment Environments section.
  3. In the Basic Information step, select Java in the Technology Stack Type field and enter an application name and description. After the configuration is complete, click Next.
  4. In the Deployment Environment Information step, enter a deployment environment name, and select Upload Local Application in the Deployment Package Source setting. Then, upload the file, configure the version for the deployment package, and then click Creation Complete.
  5. In the Creation Complete step, click View Application or Creation Complete to go to the Overview tab of the Application Details page. Click the name of a deployment environment to go to the Overview tab of the Deployment Environment Details page, and click the link next to the Public IP Address to view the homepage of the application.


What can I do if I cannot access a website because a health check fails?

If you use an SLB instance, we recommend that you take the following code as an example to create a controller. In this controller, you must specify the behavior of the controller to accept head requests. Then, you need to specify the URL of the controller as the health check URL. Otherwise, you may fail to access a website due to a health check failure.
package controllers

import (

type MainController struct {

func (c *MainController) Get() {
  c.Data["Website"] = ""
  c.Data["Email"] = ""
  c.TplName = "index.tpl"

func (c *MainController) Head() {

More information