Omnibus Gitlab CentOS 7使用Let's Encrypt配置免費ssl

來源:互聯網
上載者:User

標籤:

首先安裝omnibus gitlab,參照

https://about.gitlab.com/downloads/

 

參照以下兩篇文章結合配置:

https://certbot.eff.org/#centosrhel7-nginx

https://webnugget.de/setting-up-gitlab-with-free-ssl-certs-from-lets-encrypt-on-ubuntu-14-04/

 

1.安裝certbot。

$ sudo yum install epel-release$ sudo yum install certbot

 

2.配置gitlab:

$ vi /etc/gitab/gitlab.rb
更改以下配置項:
external_url "http://gityu.com/"nginx[‘redirect_http_to_https‘] = truenginx[‘ssl_certificate‘]= "/etc/letsencrypt/live/gityu.com/fullchain.pem"nginx[‘ssl_certificate_key‘] = "/etc/letsencrypt/live/gityu.com/privkey.pem"  
nginx[‘custom_gitlab_server_config‘]="location ^~ /.well-known {\n alias /var/www/letsencrypt/.well-known;\n}\n"  

重啟gitlab:

$ gitlab-ctl reconfigure

3.產生認證:
$ certbot certonly

按照步驟配置如:

使用webroot外掛程式,填寫網域名稱:gityu.com,

根路徑:/var/www/letsencrypt

 

 

 
最後成功安裝,有效期間90天。

 

4.生效https://:

$ vi /etc/gitlab/gitlab.rb

更改:

external_url "https://gityu.com/"
 

重啟gitlab使生效:

$ gitlab-ctl reconfigure

 
此時可以訪問gityu.com會自動重新導向到https://gityu.com,並且認證為綠色:

 

5.建立crontab job,自動更新認證。

$ vi /etc/cron.monthly/renew-ssl-certificates

填入以下內容: 
certbot renew --quiet 

這樣每個月更新一次,也可以使用crontab -e來建立crontab job。

 

注意,使用此命令之前先使用以下命令驗證是否可以成功更新:

$ certbot renew --dry-run

 如果命令失敗,那麼可以使用以下文章中的方法作為備用:

 https://webnugget.de/setting-up-gitlab-with-free-ssl-certs-from-lets-encrypt-on-ubuntu-14-04/

即使用以下指令碼來自動更新:

#!/bin/bash/bin/letsencrypt certonly -c /root/letsencrypt-config/gitlab.ini --renew-by-defaultgitlab-ctl restart

Omnibus Gitlab CentOS 7使用Let's Encrypt配置免費ssl

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.