vim /etc/gitlab/gitlab.rb
将
nginx['enable'] = true
修改为
nginx['enable'] = false
并去掉注释 (前边的#)
gitlab_workhorse['enable'] = true
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:9000" //这个端口号一会和Nginx代理的端口号要一致
#重启
gitabl-clt reconfigure
gitlab-ctl restart
禁用prometheus_monitoring 网络监控
prometheus_monitoring['enable'] = false
使用服务原本的nginx转发
location / {
proxy_pass http://127.0.0.1:9000;
#root html;
client_max_body_size 0;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
index index.html index.htm;
proxy_set_header X-Forwarded-Proto https;
}
server {
listen 80;
client_max_body_size 0; #一定要加上这个参数,gitlab push大小限制,0表示没有大小限制
server_name xxxxxxx.com;
server_tokens off;
location / {
root html;
index index.html index.htm;
proxy_pass http://127.0.0.1:9000; #这里与前面设置过的端口一致
proxy_read_timeout 3600;
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;
}
}
网友评论