Omnibus Gitlab CentOS 7 Use Let's encrypt configure free SSL

Source: Internet
Author: User
Tags free ssl certbot letsencrypt

First install omnibus Gitlab, refer to

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

Refer to the following two articles in conjunction with configuration:

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

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

1. Install the Certbot.

$ sudo yum install epel-release$ sudo yum install Certbot

2. Configure Gitlab:

$ vi/etc/gitab/gitlab.rb
Change the following configuration items:
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"  

Restart Gitlab:

$ gitlab-ctl reconfigure

3. Generate the Certificate:
$ Certbot certonly

Follow the steps to configure such as:

Using the Webroot plugin, fill in the domain name: gityu.com,

Root path:/var/www/letsencrypt

 
最后成功安装,有效期90天。

4. Effective https://:

$ vi/etc/gitlab/gitlab.rb

Change:

external_url "https://gityu.com/"
 

Restart the Gitlab to take effect:

$ gitlab-ctl Reconfigure

 
此时可以访问gityu.com会自动重定向到https://gityu.com,并且证书为绿色:

5. Create the crontab job to automatically update the certificate.

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

Fill in the following content:

This is updated once a month, or you can use CRONTAB-E to create a crontab job.

Note that the following command is used before using this command to verify that the update is successful:

$ Certbot Renew--dry-run

If the command fails, you can use the methods in the following article as an alternative:

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

Even if the script is automatically updated:

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

Omnibus Gitlab CentOS 7 Use Let's encrypt configure free SSL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.