Upload Go executeable and other files

Go Folders

You can store your Go files where you want. I chose to keep folders and files ingo the /home folder but a common place is also /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.

1. Compile Go library

In your main executeable you set the desired port

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

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

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

                cd /home/yoursite1/
2. Open your site in a web browser

Open a browser and type: (replace ip with your VPS ip-address)

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