Install an SSL certificate on your Gitlab server


Table of Contents

Install an SSL certificate on your Gitlab server

In addition to being a collaborative software development platform, it is also an open-source code repository used for large DevOps and security projects. There is no charge for GitLab for individuals. With GitLab, you can store code, track issues, and conduct continuous integration and delivery. It is important to ensure the security of your server by adding an SSL certificate. In online communications, an SSL certificate provides security on your web server. In the event that a user contacts your secured website, an encrypted connection is established through an SSL certificate. Our goal in this article is to show you how to install a SSL certificate in your Gitlab server.

If you do not already have a VPSie account, you will need to create one in order to register Ubuntu systems. If you don’t already have Gitlab, you can install it in the marketplace with one click.

Let’s Encrypt is being used here. Your website will be secured by this free security certificate issued by Let’s Encrypt authorities. As Let’s Encrypt is supported with GitLab. in this step, we will set up a secure connection using Let’s Encrypt SSL in GitLab.

First: Now open your terminal and run the following commands to update your Gitlab.

# apt-get update && apt-get upgrade -y 

Now open and edit the file gitlab.rb using any text editor, here we’re using nano. You can do this by running the following command.

# sudo vim /etc/gitlab/gitlab.rb

Below are the lines that need to be edited.

letsencrypt['enable'] = true
letsencrypt['auto_renew'] = true
lets encrypt

As follows are the hours and days that can be defined for auto renewal.

letsencrypt['auto_renew_hour'] = 7
letsencrypt['auto_renew_day_of_month'] = "*/3"

Then Replace HTTP with HTTPS in the URL line:

external_url 'https://localhost'
lets encrypt

The ACME server can not issue a certificate for an IP address so we hope you have domain to access the wepage.

Ensure that the changes are correct and save and then exit the configuration file. Ensure the above changes are in effect by running the following command:

# sudo gitlab-ctl reconfigure

# sudo gitlab-rake gitlab:check
lets encrypt

You should see a lock on the URL once your webpage has been refreshed. You are secure if that is the case.

I appreciate you reading this article and have secure communication.

Share on