Configure Gitlab Server for HTTPS
Frederick Ollinger

Frederick Ollinger @frederickollinger

About: Linux / Python / DevOps / Crypto / Cloud

Joined:
Jun 22, 2022

Configure Gitlab Server for HTTPS

Publish Date: Aug 3 '22
5 0

Minimal configuration steps for Gitlab Server after you install it to create TSL certificates and run over https.

Step one is to actually make the TSL certs.

IP=`hostname -I | sed 's/ //g'`
mkdir -p /etc/gitlab/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/gitlab/ssl/${IP}.key -out /etc/gitlab/ssl/${IP}.crt
Enter fullscreen mode Exit fullscreen mode

Get IP:

hostname -I
Enter fullscreen mode Exit fullscreen mode

Now edit /etc/gitlab/gitlab.rb. Replace SERVER with the output of IP.

external_url 'https://SERVER'
nginx['redirect_http_to_https'] = true

nginx['enable'] = true
nginx['client_max_body_size'] = '250m'
nginx['redirect_http_to_https'] = true
nginx['ssl_certificate'] = "/etc/gitlab/ssl/SERVER.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/SERVER.key"
Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment