vim /etc/gitlab
在最末尾添加
nginx['custom_gitlab_server_config'] = "location /api/v4 {
deny all;}\n"
重新加载gitlab
gitlab-ctl reconfigure
附:限制ip访问操作
nginx['custom_gitlab_server_config'] = "location ~* (.*) {
deny 192.168.2.109;
allow 192.168.2.0/24;
deny all;
proxy_cache off;
proxy_pass http://gitlab-workhorse;
root html;
index index.html index.htm;}\n"