gitlab安装

一、添加清华源

cat>>/etc/yum.repos.d/gitlab-ce.repo<<EOF
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
EOF

二、更新本地yum缓存,下载gitlab

yum makecache

yum install gitlab-ce -y

 

三、修改配置文件

vim /etc/gitlab/gitlab.rb
external_url 'http://10.0.0.120'  ##改这一行
gitlab-ctl reconfigure

  

四、自己编译的nginx配置

upstream gitlab {
    server unix:///var/opt/gitlab/gitlab-workhorse/socket;
}
server
  {
    listen       80;
    server_name  testgit.168p2p.com;
     server_tokens off;
    root /opt/gitlab/embedded/service/gitlab-rails/public;
    access_log /var/log/gitlab/nginx/gitlab_access.log;
    error_log /var/log/gitlab/nginx/gitlab_error.log;
    location / {
         try_files $uri $uri/index.html $uri.html @gitlab;
    }
    location @gitlab {
 
       proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
         proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Frame-Options SAMEORIGIN;
 
            proxy_pass http://gitlab;
             }
    location ~ ^/(assets)/ {
     root /opt/gitlab/embedded/service/gitlab-rails/public;
     expires max;
    add_header Cache-Control public;
     }
 
      error_page 502 /502.html;
      }

  

五、根据日志授权

chmod 755  /var/opt/gitlab/gitlab-workhorse/ 

posted @ 2018-06-13 14:05  巽逸  阅读(193)  评论(0编辑  收藏  举报