Answer the question
In order to leave comments, you need to log in
How to run compiled Golang binaries under Ubuntu?
Wrote a small Go program using the net/http package. The whole task comes down to listening to port 80 and responding to requests (a la hello, world). I use the log package to handle web server startup errors. The rights to the binary: 777, the owner is the one from whom I launch.
2016/11/20 11:11:27 Cannot start and listen: listen tcp :80: bind: permission denied
Answer the question
In order to leave comments, you need to log in
It has nothing to do with Go.
Under Linux, only an application with root rights can listen on port 80 (or rather, all ports less than 1024).
For example, you can throw it through nginx. Moreover, nginx will be very good for static and for protection against slow clients.
There are tons of options. The ultimate goal is to somehow launch the application, incl. when you restart your computer.
For example, you can turn it into a daemon (carefully, a Go program does not turn into a daemon so easily https://habrahabr.ru/post/187668/ so it will be easier to use third-party ready-made packages to daemonize a program on go)
Fashionable youth method - through Docker/ rkt - also written in Go.
An even more fashionable youth method is through a scheduler designed for clusters, for example Hashicorp Nomad (which, by the way, is also written in Go).
Here it is written how to run Nomad itself https://github.com/hashicorp/nomad/tree/master/dist
If you do without Docker and Nomad - the same recipe can be used for your application.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question