Gitlab启用SSL

2024-01-03  本文已影响0人  87d6dc4b11a7
docker run --detach \
  --hostname gitlab.example.com \
  --publish 443:443 --publish 8090:8090 --publish 2222:22 \
  --name gitlab \
  --restart always \
  -v /etc/localtime:/etc/localtime \
  -v /srv/gitlab/config:/etc/gitlab \
  -v /srv/gitlab/logs:/var/log/gitlab \
  -v /srv/gitlab/data:/var/opt/gitlab \
  --shm-size 512m \
  gitlab/gitlab-ce:16.4.1-ce.0

1、Make the following changes to /etc/gitlab/gitlab.rb:

# Update external_url from "http" to "https"
external_url "https://my-host.internal"

# Set Let's Encrypt to false
letsencrypt['enable'] = false

2、Create the following directories with the appropriate permissions for generating self-signed certificates:

sudo mkdir -p /etc/gitlab/ssl
sudo chmod 755 /etc/gitlab/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/gitlab/ssl/my-host.internal.key -out /etc/gitlab/ssl/my-host.internal.crt

3、Reconfigure your instance to apply the changes:

sudo gitlab-ctl reconfigure
上一篇 下一篇

猜你喜欢

热点阅读