vim /etc/gitlab/gitlab.rb
external_url 'https://101.101.101.63' #启用https,默认是http
(改端口:external_url 'https://10.1.75.177:8881' )
或者:
external_url 'https://gitlab.xxx.net' # 需要改本地的hosts文件,或者改DNS服务器的解析指向
nginx['enable'] = true
nginx['redirect_http_to_https'] = true #http重定向到https
nginx['ssl_certificate'] = "/etc/gitlab/ssl/server.crt" #ssl证书路径
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/server.key" #ssl秘钥路径
mkdir /etc/gitlab/ssl
chmod 700 /etc/gitlab/ssl/ -R
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/gitlab/ssl/server.key -out /etc/gitlab/ssl/server.crt
自签名证书 参考:https://www.cnblogs.com/andy9468/p/10414371.html
gitlab-ctl reconfigure # 更新配置。等1分钟左右
gitlab-ctl status # 查看状态。