Install go and configure GOPATH.
The specific method is as follows:
1. Configure the server to the same local environment, including the packages that the project depends on;
2. Copy the project source code to the server. Compile on the server
go build main.go
After compilation, the executable file main will be generated in the same directory.
3. Finally execute ./main.
If you want the project to execute in the background: execute nohup ./main &, so that the program can run in the background.
Recommended related articles and tutorials: golang tutorial
The above is the detailed content of How to deploy golang project to linux server. For more information, please follow other related articles on the PHP Chinese website!