在 nginx 后面使用 GitLab 启用了 basic_auth? [英] Using GitLab behind nginx enabled basic_auth?
问题描述
我已经成功安装了 GitLab 来管理私有存储库(这太棒了!).
I've successfully installed GitLab for management of private repositories (it's quite awesome!).
我遇到的问题是默认情况下,当有人访问我的子域时会显示 Gitlab 登录.我想在用户获得 GitLab 登录屏幕之前用 basic_auth 层保护整个区域.不幸的是,这破坏了我在启用 GitLab 时推/拉的能力.
The problem I am having is by default, Gitlab login is presented when anyone hits my subdomain. I would like to protect the entire area with a basic_auth layer before the user gets the GitLab login screen. Unfortunately, this breaks my ability to push/pull from GitLab when it's enabled.
我的 nginx 配置启用 basic_auth:
my nginx config to enable basic_auth:
auth_basic "Restricted";
auth_basic_user_file htpasswd;
关于如何在不破坏 git/gitlab 功能的情况下启用 basic_auth 的任何想法?
Any ideas on how I can enable basic_auth without breaking git / gitlab functionality?
推荐答案
将此添加到 /etc/gitlab/gitlab.rb
:
nginx['custom_gitlab_server_config'] = "auth_basic 'Restricted';
auth_basic_user_file htpasswd;
"
然后运行 gitlab-ctl reconfigure
这篇关于在 nginx 后面使用 GitLab 启用了 basic_auth?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!