Gitlab配置修改以及启动

常用命令

1
2
3
4
5
启动服务:gitlab -ctl start
查看状态:gitlab -ctl status
停掉服务:gitlab -ctl stop
配置生效:gitlab -ctl reconfigure
重启服务:gitlab -ctl restart

配置文件

修改gitlab的配置文件

1
# vim /etc/gitlab/gitlab.rb

数据存储目录

1
2
3
4
5
git_data_dirs({
"default" => {
"path" => "/mnt/gitlab/git-data"
}
})

域名

1
external_url 'http://gitlab.yourdomain.com'

端口

1
nginx['listen_port'] = 8091

配置好端口后,就可以通过系统nginx转发到此端口,优雅的采用80端口提供服务

nginx转发配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#
# gitlab
#
server {
listen 80;
server_name gitlab.yourdomain.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
proxy_connect_timeout 600s;
client_max_body_size 20m;
proxy_pass http://127.0.0.1:8091;
}
}

然后就可以通过http://gitlab.yourdomain.com访问gitlab了

其它配置

版权所有,如有侵权请联系我