Hamburger
Hub
goHosting

Upload Go executeable and other files

Go Folders

I chose to keep the Nginx way to put folders and files in /var/www. Each "site" should have its own folder and within this "site folder" the Go executable. At the same level there can be a "public" folder to put all web stuff in. So the first step is to recreate your local folder structure in each site folder.

(root)/var/www/sitename/public folder + Go executeable/other web stuff...

Before you upload it to Linux VPS, you have to compile the main Go file (normally main.go). This is done in your favorite IDE (In my case Sublime) by selecting the main.go and opening the Terminal. Fire this command to compile:

GOOS=linux go build

Then upload the Go executable to the target site folder.

Upload Go executeable

When the Go executable is uploaded to the VPS, you have to change permissions to 0755

Go Folders

In your main executeable you set the desired port

func main() {
  http.HandleFunc("/", endpoint)
  log.Fatal(http.ListenAndServe(":9093", nil))
}

You can test if the Go executable starts by entering this two command lines in Webmin terminal:

cd /var/www/yoursite/
./main

Open a browser and type:

http://94.237.98.87:9093/ (replace ip with your VPS ip-address)

Next step is to activate systemd and create a "restart button"