环境:阿里云,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;
}
}