Home >Backend Development >Golang >How to deploy Golang on Pagoda panel
Pagoda Panel is a commonly used server management panel. It provides rich functions and supports one-click installation of multiple applications, which greatly simplifies the difficulty of server management. Quickly deploying Golang on the Pagoda panel can greatly improve development efficiency. This article will introduce how to deploy Golang on the Pagoda panel.
1. Install the Pagoda Panel
First, you need to install the Pagoda Panel on the server. We can directly download the panel installation program from the Pagoda official website. Download the installer via the following command:
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
After the installation is complete, we can access the panel by accessing the server IP address and port 8091.
2. Create a website
In the Pagoda panel, we need to create a website first to facilitate the deployment of Golang applications on it. The specific steps are as follows:
3. Install Golang
Next, we need to install Golang on the server. You can install it through the following command:
wget https://studygolang.com/dl/golang/go1.15.6.linux-amd64.tar.gz
After decompression, unzip the Golang binary folder Add it to the system environment variables for easy use.
4. Deploy Golang applications
In the Pagoda panel, we can upload the Golang program source code and build the program through the "File Management" function.
go build -o ../goapp main.go
After the build is successful, a binary file named "goapp" will be generated in the "go" directory. This is the Golang program we need to deploy.
killall goapp nohup ./goapp > ../logs/goapp.log 2>&1 &
This script implements the program Restart the function and redirect the program's output to a log file.
5. Start the Golang application
In the "File Management" interface, enter the "go" directory and run the following command to start the Golang application:
sh restart.sh
The program started successfully After that, the website can be accessed through the browser and the Golang application can be accessed.
Summary
Rapid deployment of Golang applications through the Pagoda Panel can quickly improve development efficiency. This article introduces how to install Golang and deploy Golang applications on the Pagoda Panel. If you encounter problems you can seek help in the official forum.
The above is the detailed content of How to deploy Golang on Pagoda panel. For more information, please follow other related articles on the PHP Chinese website!