vim /etc/gitlab.rb
在最末尾添加(最后一条生效)
#禁止/api/v4
nginx['custom_gitlab_server_config'] = "location /api/v4 {deny all;}"
#禁止/api/v4,禁止注册、禁止找回密码
nginx['custom_gitlab_server_config'] = "location /api/v4/ {deny all;} location /users/password/new {deny all;} location /users/sign_up {deny all;}"
重新加载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;}"