GitLab 配置 Let’s Encrypt 颁发的 SSL免费证书

作者: root007 分类: Linux,中间件 发布时间: 2019-11-28 16:00

参考:
https://certbot.eff.org/docs/ h

安装 Let’s Encrypt 客户端

root@iZbp1gzimbaykc3ahbss48Z:~# git clone https://github.com/certbot/certbot

申请ssl证书

root@iZbp1gzimbaykc3ahbss48Z:~# cd certbot/
 root@iZbp1gzimbaykc3ahbss48Z:~/certbot# ./certbot-auto --agree-tos --email ops@test.com
example.com  certonly --webroot -w /opt/gitlab/embedded/service/gitlab-rails/public/ -d git.example.com

certonly只申请证书

--agree-tos同意用户协议

webroot插件通过为中的每个您请求的域创建一个临时文件来工作${webroot-path}/.well-known/acme-challenge。然后,让我们加密验证服务器发出HTTP请求,以验证每个请求域的DNS都解析为运行certbot的服务器。向您的Web服务器发出的示例请求如下所示:

66.133.109.36 - - [05/Jan/2016:20:11:24 -0500] "GET /.well-known/acme-challenge/HGr8U1IeTW4kY_Z6UIyaakzOkyQgPr_7ArlLgtZE8SX HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"

 GitLab 的默认的 nginx 服务器的根目录位于 /opt/gitlab/embedded/service/gitlab-rails/public/-d指定要申请证书的域名。

证书申请完成配置gitlab开启https

创建软连接

ln -s /etc/letsencrypt/live/git.mshare.cn/fullchain.pem  /etc/gitlab/ssl/example.pem
ln -s /etc/letsencrypt/live/git.mshare.cn/privkey.pem  /etc/gitlab/ssl/example_com.key
vim /etc/gitlab/gitlab.rb
---
external_url 'https://git.example.com'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/example.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/example_com.key"

更新配置 重启

gitlab-ctl reconfigure

 gitlab-ctl restart 

自动证书更新

sudo crontab -e
0 3 * * 1 /root/certbot/certbot-auto renew && gitlab-ctl hup nginx

使用-letsencrypt配置kubernetes-ingress-nginx免费https证书

一条评论
  • binzhou75

    2020年6月4日 上午11:14

    我用这个方法,但是验证失败,报错: http://mywebsite.com/.well-known/acme-challenge/pHC5pEq9WFmNkXMv9lYSx2VtrjG3YsGeq23IcqDisEU:
    Timeout after connect

发表评论

邮箱地址不会被公开。 必填项已用*标注


  • http://ediconcept.odns.fr/maillotdefootpascher.html
  • http://ediconcept.odns.fr/maillotsfootpascher.html
  • http://ediconcept.odns.fr/maillotsfootpascher2022.html
  • https://sergiofajardo.co/maillotdefootpascher.html
  • https://sergiofajardo.co/maillotsfootballpascher.html
  • https://sergiofajardo.co/maillotsfootpascherfrance.html
  • https://allphonetoys.com/maillotdefootpascher.html
  • https://allphonetoys.com/nouveaumaillotdefootpascher.html
  • https://allphonetoys.com/nouveaumaillotsdefootball.html
  • http://samosystem.nichost.ru/maillotdefootpascher.html
  • http://samosystem.nichost.ru/nouveaumodèlemaillotdefoot.html
  • http://samosystem.nichost.ru/pascherfemmesfootballjersey.html
  • http://w96397on.beget.tech/maillotdefootpascher.html
  • http://w96397on.beget.tech/pascherfootballt-shirts.html
  • http://w96397on.beget.tech/paschermaillotsdefootpromo.html
  • http://wesleywang.acsite.org/maillotdefootpascher.html
  • https://wesleywang.acsite.org/repliquemaillotsdefootballlivraisongratuite.html
  • https://wesleywang.acsite.org/retrovintagesoccerjerseys.html
  • https://www.rnkhabri.com/maillotdefootpascher.html
  • https://www.rnkhabri.com/personnaliséenfantssoccerjersey.html
  • https://www.rnkhabri.com/personnaliséfemmessoccervêtements.html
  • https://www.oujdacity.net/maillotdefootpascher.html
  • https://www.oujdacity.net/sitedemaillotdefootpascher.html
  • https://www.oujdacity.net/survetementdefoot.html
  • https://infendo.com/maillotdefootpascher.html
  • https://infendo.com/survetementdefootpascher.html
  • https://infendo.com/uniformedefootballdesjeunes.html
  • https://planitagency.com/maillotdefootpascher.html
  • https://planitagency.com/ventemaillotdefootpascherthailande2022.html
  • https://planitagency.com/vesteequipedefoot.html
  • http://immergut.com.br
  • https://immobiliarelerosemarine.com
  • https://immobilienfotografie24.de
  • http://immobilier-lemaroc.com
  • https://imobilideranca.com.br
  • https://impactdigital.space
  • https://imperibiza.com
  • https://impexworldltd.com
  • https://implant.gen.tr
  • https://impread.com
  • http://improveyourdance.com
  • http://improvisamos.com
  • http://impulsarh.com.ar
  • http://inamakethat.com
  • http://inanna.be
  • https://incomementorbox.com
  • https://incomerepairpro.com
  • https://indiatvnewss.com
  • https://indoranews.com
  • https://infendo.com
  • https://infinitebankingagenttraining.com
  • https://infinnium.com
  • http://influenceyourway.com
  • http://infocarbrokers.net
  • http://infohealth-usa.com
  • https://informatic-crew.fr
  • https://informatiotech.com
  • https://informeblumenau.com
  • https://infos-grossesse.fr
  • https://ingatlanmagus.com