sudo adduser git
su git
cd ~
wget https://dl.gogs.io/0.11.86/gogs_0.11.86_linux_amd64.tar.gz
tar -zxvf gogs_0.11.86_linux_amd64.tar.gz
cd /home/git/gogs/scripts
mysql -u root -p
source mysql.sql
show databases;
vim /home/git/gogs/scripts/init/centos/gogs
19 PATH=/sbin:/usr/sbin:/bin:/usr/bin
20 DESC=”Gogs”
21 NAME=gogs
22 SERVICEVERBOSE=yes
23 PIDFILE=/var/run/$NAME.pid
24 SCRIPTNAME=/etc/init.d/$NAME
25 WORKINGDIR=/home/git/gogs # 仓库地址,可以自行修改
26 DAEMON=$WORKINGDIR/$NAME
27 DAEMON_ARGS=”web”
28 USER=git # 如果运行 gogs 不是名为 git 的账户,则需要修改。
su root
sudo cp /home/git/gogs/scripts/init/centos/gogs /etc/init.d/
sudo chmod +x /etc/init.d/gogs
cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/
service gogs start
cd /home/git/gogs
./gogs web >/dev/null 2>&1 & //后台运行
server {
listen 80;
server_name xxxx;
location / {
proxy_pass http://127.0.0.1:3000/;
}
}