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;}"

原文

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐