在启用Nginx的背后使用GitLab启用basic_auth? [英] Using GitLab behind nginx enabled basic_auth?

查看:175
本文介绍了在启用Nginx的背后使用GitLab启用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';\n  auth_basic_user_file htpasswd;\n"

然后运行gitlab-ctl reconfigure

这篇关于在启用Nginx的背后使用GitLab启用basic_auth?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆