sudo adduser git
切换到 git 用户,并在其账户所在家目录,下载 Gogs 执行 gogs 数据库文件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/;
}
}
浏览器访问 http:// 远程主机 IP 地址 :3000