CentOS安装Gogs

CentOS 安装Gogs
一、 下载安装
1. 创建git用户
useradd git2 安装git
yum install git3 下载gogs二进制包
下载地址: https://dl.gogs.io/0.11.91/gogs_0.11.91_linux_amd64.tar.gz
wget https://dl.gogs.io/0.11.91/gogs_0.11.91_linux_amd64.tar.gz4 解压
tar -zxvf gogs_0.11.91_linux_amd64.tar.gz5 修改权限
chwon -R git.git /home/git/二、运行
进入gogs/目录下
1.直接运行
./gogs web2 后台运行
nohup ./gogs web &3 访问
http://39.106.178.64:3000/三、配置
1 访问进行配置
http://39.106.178.64:3000/2 开机启动
(1)复制启动脚本
cp /home/git/gogs/scripts/init/centos/gogs /etc/init.d/(2)修改权限
chmod +x /etc/init.d/gogs#####(3)添加启动
chkconfig /etc/init.d/gogs on (4)启动与停止命令
service gogs start    #启动服务service gogs stop     #停止服务
service gogs restart  #重启服务
chkconfig --list gogs #查看是否生效
3 配置二级域名
#####(1) 在 /etc/nginx/conf.d 新建 git.conf 文件,内容如下:
upstream git { server localhost:3000;
}
server {
    listen       80;
    server_name  git.lwenhao.com;
    client_max_body_size 20M;
    location / {
       proxy_pass http://git;
       proxy_set_header Host $host:$server_port;
       proxy_set_header X-Real_IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Scheme $scheme;
       proxy_connect_timeout 3;
       proxy_read_timeout 3;
       proxy_send_timeout 3;
       access_log off;
       break;
    }
    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
 }
}
(2) 访问
http://git.lwenhao.com/以上是 CentOS安装Gogs 的全部内容, 来源链接: utcz.com/z/511123.html








