ตั้งแต่เวอร์ชั่นนี้ การเปิดใช้งาน SSL สามารถทำได้ง่ายๆ เพราะ Gitlab เค้ามี Options และ สามารถใช้งาน auto ของ Let's Encrypt สำหรับ renew ได้เองเลย
มาเริ่มกันเลย (ตัวอย่างนี้ ติดตั้ง Gitlab บน Ubuntu)
1. เปิดไฟล์ /etc/gitlab/gitlab.rb ขึ้นมาแก้ไข
โค้ด: เลือกทั้งหมด
nano /etc/gitlab/gitlab.rb
external_url ให้ url ใช้ https ดังตัวอย่าง
โค้ด: เลือกทั้งหมด
external_url 'https://git.mindphp.com'
โค้ด: เลือกทั้งหมด
letsencrypt['enable'] = true
โค้ด: เลือกทั้งหมด
nginx['redirect_http_to_https'] = true
nginx['redirect_http_to_https_port'] = 80
โค้ด: เลือกทั้งหมด
sudo gitlab-ctl reconfigure
ถ้าเจอ Error ประมาณนี้
ให้แก้ปัญหาโดยการRunning handlers:
There was an error running gitlab-ctl reconfigure:
letsencrypt_certificate[git.mindphp.com] (letsencrypt::http_authorization line 5) had an error: RuntimeError: acme_certificate[staging] (/opt/gitlab/embedded/c ookbooks/cache/cookbooks/letsencrypt/resources/certificate.rb line 25) had an error: RuntimeError: ruby_block[create certificate for git.mindphp.com] (/opt/git lab/embedded/cookbooks/cache/cookbooks/acme/resources/certificate.rb line 108) had an error: RuntimeError: [git.mindphp.com] Validation failed, unable to reque st certificate
โค้ด: เลือกทั้งหมด
gitlab-ctl renew-le-certs
เท่านี้เราก็จะสามารถเข้าใช้งาน Gitlab ของเราได้ด้วย https แล้ว
ติดตามผลงานทางโปรแกรมตางๆ ของ Mindphp.com ได้ที่
https://git.mindphp.com
เรามี Open Source ไว้ให้ท่านนำไปใช้ และ รวมพัฒนากับเรามากมาย