Upload Go executeable and other files

Go Folders

I did chose to keep the Nginx way to put folders and files in /var/www. Each "site" should have its own folder and with in this "site folder" the Go executeable. 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 open 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 executeable 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 executeable starts by entering this two command lines in Webmin terminal:
cd /var/www/yoursite/
Open a browser and type: (replace ip with your VPS ip-address)

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