这两个都很好安装, 需要处理的问题就是 gitlab 与 vestacp 都有 nginx, 并且都会占用 80 端口. 所以配置 gitlab 不开启 nginx, 然后在 vestacp 的 nginx 添加 gitlab 的代理.
gitlab 主要配置:
external_url 'http://git.justchen.com'
git_data_dir "/home/gitdata/data"
gitlab_rails['backup_path'] = "/home/gitdata/backup"
unicorn['worker_processes'] = 3
unicorn['worker_timeout'] = 120
nginx['enable'] = false
安装 vestacp 会自动安装 nginx, 修改 nginx 配置文件 /etc/nginx/nginx.conf
在 include /etc/nginx/conf.d/*.conf; 上面加入以下代码
#================ GITLAB ===================!
upstream gitlab-workhorse {server unix:/var/opt/gitlab/gitlab-workhorse/socket;}
server {
listen 157.7.52.115:80;
server_name git.justchen.com;
server_tokens off; ## Don't show the nginx version number, a security best practice
root /opt/gitlab/embedded/service/gitlab-rails/public;
## Increase this if you want to upload large attachments
## Or if you want to accept large git objects over http
client_max_body_size 0;
## Individual nginx logs for this GitLab vhost
access_log /home/logs/gitlab_access.log;
error_log /home/logs/gitlab_error.log;
location / {
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
## 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 http;
proxy_pass http://gitlab-workhorse;
}
}
# Wildcard include
include /etc/nginx/conf.d/*.conf;
}
需要注意的是,nginx 的运行身份也得是 git
20161010 更新:
在 gitlab 升级后,部份项目会出现 500 错误,这里动要运行以下命令解决:
sudo gitlab-rails runner "Project.where.not(import_url: nil).each {|p| p.import_data.destroy if p.import_data}"
正文完