GitLab 启用HTTPS

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

其实由于GitLab只负责监听本地socket文件,而web服务器采用了Nginx等。只需要在web server上做适当的配置即可。

下面是一个采用Nginx的例子,对GitLab安装指南下载的gitlab脚本文件做了适当的修改。

# GITLAB# Maintainer: @randx# App Version: 4.0upstream gitlab {  server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;}server {  listen 443;  ssl                  on;  ssl_certificate      /etc/nginx/sites-available/server.crt;  ssl_certificate_key  /etc/nginx/sites-available/server.key;  server_name localhost;  #ubuntu1204-dell source.cml.com;     # e.g., server_name source.example.com;  root /home/gitlab/gitlab/public;  # individual nginx logs for this gitlab vhost  access_log  /var/log/nginx/gitlab_access.log;  error_log   /var/log/nginx/gitlab_error.log;  location / {    # serve static files from defined root folder;.    # @gitlab is a named location for the upstream fallback, see below    try_files $uri $uri/index.html $uri.html @gitlab;  }  # if a file, which is not found in the root folder is requested,  # then the proxy pass the request to the upsteam (gitlab unicorn)  location @gitlab {    proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694    proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694    proxy_redirect     off;    proxy_set_header   X-Forwarded-Proto $scheme;    proxy_set_header   Host              $http_host;    proxy_set_header   X-Real-IP         $remote_addr;    proxy_pass http://gitlab;  }}

注意 server { 下面的四行。

监听443端口,启用ssl,server.crt和server.key文件是参考Nginx的文档生成的。

最后proxy_pass http://gitlab 不能修改,不要改成https,否则不能工作。


现在试一下用https的方式check out 代码:

git clone https://....

报错,说证书校验有问题:

error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

最简单的解决方法是加一个环境变量:

export GIT_SSL_NO_VERIFY=1


           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
这里写图片描述
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值