阿里云上ubuntu系统安装gitlab

环境:阿里云,ubuntu16.04,内存2G(有点卡,建议4+

使用清华大学镜像(比较快):https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

安装成功后要修改extern_url,改为自己的网址

使用本地nginx,需更改两个地方:

1 nginx['enable'] = false

2 web_server['external_users'] =['www-data']

 

502 bad gateway

1、猜测两个目录无权限:

一个是

upstream gitlab { #7.x 版本在此位置 # serverunix:/var/opt/gitlab/gitlab-rails/tmp/sockets/gitlab.socket; # 8.0 位置 serverunix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket; }

另一个

root/opt/gitlab/embedded/service/gitlab-rails/public;

 

待证实

 

2、文件配置冲突

 gitlab_workhorse/var/opt/gitlab/gitlab-workhorse/socket冲突,会报502 bad gateway

 

 gitlab_workhorse需要注释掉,否则upstream中只能用 server unix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;

 

 /etc/nginx/sites-enabled中完整的nginx配置文件

<------------------------------------------------------------------------------->

## GitLab 8.3+

##

## Lines startingwith two hashes (##) are comments with information.

## Lines startingwith one hash (#) are configuration parameters that can be uncommented.

##

##################################

##        CONTRIBUTING          ##

##################################

##

## If you changethis file in a Merge Request, please also create

## a Merge Requeston https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests

##

###################################

##         configuration         ##

###################################

##

## Seeinstallation.md#using-https for additional HTTPS configuration details.

 

upstreamgitlab-workhorse {

  serverunix:/var/opt/gitlab/gitlab-workhorse/socket;

#  serverunix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;

}

 

## Normal HTTP host

server {

  ## Either remove "default_server"from the listen line below,

  ## or delete the/etc/nginx/sites-enabled/default file. This will cause gitlab

  ## to be served if you visit any address thatyour server responds to, eg.

  ## the ip address of the server (http://x.x.x.x/)n 0.0.0.0:80 default_server;

  listen 0.0.0.0:80 default_server;

  listen [::]:80 default_server;

  server_name gitlab.dwenb.com; ## Replace thiswith something like gitlab.example.com

  server_tokens off; ## Don't show the nginxversion number, a security best practice

  root/opt/gitlab/embedded/service/gitlab-rails/public;

 

  ## Seeapp/controllers/application_controller.rb for headers set

 

  ## Individual nginx logs for this GitLabvhost

  access_log /var/log/nginx/gitlab_access.log;

  error_log  /var/log/nginx/gitlab_error.log;

 

  location / {

    client_max_body_size 0;

    gzip off;

 

    ## https://github.com/gitlabhq/gitlabhq/issues/694

    ## Some requests take more than 30 seconds.

    proxy_read_timeout      300;

    proxy_connect_timeout   300;

    proxy_redirect          off;

 

    proxy_http_version 1.1;

 

    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-Forwarded-Proto   $scheme;

 

    proxy_pass http://gitlab-workhorse;

  }

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值