How to install SSL certificate on gitlab
How to install SSL certificate on gitlab
Date Posted: 06-10-2017
This post explains on how to install SSL certificate on gitlab. This post assumes that we have SSL certificate purchased already and we have a private key with us.
Assumption:
- Gitlab installed. Configuration path is /etc/gitlab
- SSL certificate and private key
- Domain name – git.domain.tld
Implementation:
Create a ssl directory.
mkdir -p /etc/gitlab/ssl
Change the SSL directory permission.
chmod 700 /etc/gitlab/ssl
Create a certificate file and append the certificate file content in it.
vi /etc/gitlab/ssl/domaintld.pem
Create a key file and append the private key content in it.
vi /etc/gitlab/ssl/domaintld.key
Now, edit gitlab configuration to use ssl. Also, we will be redirecting all the request to ssl rather than http port
vi /etc/gitlab/gitlab.rb
external_url 'https://git.domain.tld' nginx['redirect_http_to_https'] = true nginx['ssl_certificate'] = "/etc/gitlab/ssl/domaintld.pem" nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/domaintld.key"
Reconfigure gitlab application.
gitlab-ctl reconfigure
Now, access the gitlab using the new https url https://git.domain.tld